I’m using git in my ASP.NET MVC project.
I want no files from debug
, bin
or config
folder to show in the “Pending Chages” dialog so I will not have to commit them to my repository.
These files are machine specific specially the config folder.
I tried to add the following to .gitignore
:
myproject\bin**
myproject\obj**
myproject\config\**
This did not work because all files under all three folders are still displayed after each build or config changes.
What am I doing wrong?
Inside . gitignore , you can tell Git to ignore only a single file or a single folder by mentioning the name or pattern of that specific file or folder. You can also tell Git to ignore multiple files or folders using the same method.
While the sdk create the bin and obj folder, if it create a . gitignore with * as content, git will automatically ignore the content of this folder.
There is no explicit git ignore command: instead the .gitignore file must be edited and committed by hand when you have new files that you wish to ignore. . gitignore files contain patterns that are matched against file names in your repository to determine whether or not they should be ignored.
gitignore file is up-to-date and contains all the correct patterns you want to ignore. Commit or stash any outstanding local changes you might have. Your working copy should be clean before you continue.
Remove the ** from the dir name (also, I use forward slashes, don't know if that makes a difference).
Remember to remove all the offending files that might be in your repository already. A delete and commit should take care of it.
Also, if you have multiple projects you can get all bin
s ignored by not putting the project name in front. This should work:
bin
obj
config
This looks like the definitive SO answer: How do I ignore files in a directory in Git?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With