How to use Git Ignore on a self-emptying folder
I’ve got a git repo setup something like
Main -> Build -> Assets -> Resources
However, every time I compile our application, the “Build” directory gets completely wiped, thus deleting any .gitignore files within it.
- Is it safe to use the same ignores file for Git, Mercurial, and Bazaar?
- How to keep SVN from updating a directory already in repository
- git Ignoring only some changes in a file
- Git ignore deleted files
- Tortoise - is it possible to ignore new folder before committing it?
- git push folder contaning large file
How can I set a ignore to ignore that directory, from outside of it? something like:
ignore /Build/* ignore /Build
Our /Main/.gitignore looks like
### OSX ### .DS_Store .AppleDouble .LSOverride Icon # Thumbnails ._* # Files that might appear on external disk .Spotlight-V100 .Trashes ### Build ### # Build folder and log file Build/ Build/**/* build.log build npm-debug.log tmp .map
However SourceTree on OSX is still showing them as available to commit.
One Solution collect form web for “How to use Git Ignore on a self-emptying folder”
It is enough to create the
.gitignore file into your
Main directory and write inside that file the entries of the directories you want to exclude.
For example, type in your terminal
cd Main && echo "Build/" >> .gitignore (if you are using Linux).
Read this for other information: http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files