Reputation: 9
I need to exclude only one file when I add files for commit. Say my commit directory ..\Git_Folder
and I need to exclude only Git_SubFolder/x.sdf
.
How to do that?
Upvotes: 0
Views: 175
Reputation: 25373
A quick way could be to reset
that one file like this:
git add .
git reset x.sdf
This would bring the changes to x.sdf back to your working directory. To totally exclude that file from being staged by Git include it in your .gitignore
file.
Upvotes: 3
Reputation: 72
You can add the file extension to your .gitignore
file.
A convenient way to tell which files you should naturally ignore is through this site. Which will help you filter out files that shouldn't be included in the Repository for these project types.
Also see the official documentation for examples as provided here.
Hope that helps!
Upvotes: 0
Reputation: 141946
several options:
Add the file to .gitignore file
// .gitignore content
x.sdf
use this on the file which you don't want git to track
git update-index --no-assume-unchanged <file>
Use this site to generate your desired ignore file
https://www.gitignore.io/
Upvotes: 1