I'm trying to ignore the bin folder of a web project, but include the .refresh files that are in that bin folder.
Here's what I have in my .gitignore:
[Bb]in/
#Allow .refresh files for web sites
![Bb]in/*.refresh
But this isn't working. What am I doing wrong? I've also tried:
!*.refresh
With the same results.
Update:
Here's the file structure if that helps diagnose this:
\rootfolder
.gitignore
\project1
\bin
file1.dll
file1.dll.refresh
You can see where our gitignore file is located. We don't want the .dll but we do want the .refresh file.
. gitignore only ignores files that are not part of the repository yet. If you already git add ed some files, their changes will still be tracked. To remove those files from your repository (but not from your file system) use git rm --cached on them.
If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a . gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.
This is because Git can only ignore the untracked files. Thus, you need to check the repository and make sure that the file that you are trying to ignore is not added to the repository. If it is, you should remove the file from your repository, and then copy the contents of the file and add its name to . gitignore.
This way not worked for me:
[Bb]in/*
![Bb]in/*.refresh
I have used the syntax bellow on .gitignore file and worked fine.
Try it:
**/[Bb]in/*
!**/[Bb]in/*.refresh
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