I need to add some rules to my .gitignore
file, however, I can't find it in my project folder. Isn't it created automatically by Xcode? If not, what command allows me to create one?
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
My contribution is aimed at those on a mac, it can be applied to not only those working on an iOS project (as implied by the question mentioning Xcode), but any type of project.
The easy way that i do it is to go into the terminal and run
vim .gitignore
and then add the files. Usually you can just copy what you need from one of the templates on Github at https://github.com/github/gitignoreStep 1
While in your project run
vim .gitnore
Step 2
You now have your file open with vim.
Press
i
to insert text. You will see that the file is ready when you see the --INSERT-- at the bottom.Step 3 (option 1)
For Objective-C projects, you can copy from https://raw.githubusercontent.com/github/gitignore/master/Objective-C.gitignore and paste it into your
.gitignore
Then press
esc
then type in:wq
then pressreturn
. Which saves the file.Step 3 (option 2)
Add whatever files apply to your project.
If you are not sure what to add, the best keywords to use in your search engine would be to include your project type and text editor. For example, if you use Sublime you would want to add
And if you are working with a Cordova project in Dreamweaver you would want to add
To add any file in Xcode go to the menu and navigate to File -> New -> File...
For a .gitignore file choose Other -> Empty and click on Next. Type in the name (.gitignore) into the Save As field and click Create. For files starting with a dot (".") a warning message will pop up, telling you that the file will be hidden. Just click on Use "." to proceed...
That's all.
To fill your brand new .gitignore you can find an example for ignoring Xcode file here: https://stackoverflow.com/a/12021580/2120348
The following works in Powershell and Command Prompt
I ran into a weird issue where git effectively wouldn't read the .gitignore file. I then deleted .gitignore file and created one using vim which worked fine.
To add additional files to ignore, just call the following command:
It will append further files to the existing .gitignore file.
The .gitignore file is not added to a repository by default. Use vi or your favorite text editor to create the .gitignore file then issue a
git add .gitignore
followed bygit commit -m "message" .gitignore
. The following commands will take care of it.in windows, open a dos prompt(cmd) windows, use command line:
Without using command line