Reputation: 3233
I am new to using Git in TFS.
Say I have 10 files that I modified, however I would only like to commit 2 of those files.
Previously with TFS I could include/exclude what file(s) I wanted to check in.
What would the equivalent be in Git?
Would I Stage my 2 files I want to commit and check those in? Or would I stage the 8 files and commit my 2 changes?
Upvotes: 2
Views: 2428
Reputation: 359
Some trick could be used, either individually or combined
Upvotes: 0
Reputation: 78
You do not need to state all files: You can git add command to stage the files you want to commit, like:
git add [file1] [file2]
Then use git commit command to commit your change, like:
git commit -m 'commit message'
Upvotes: 0
Reputation: 10304
stage the files you want to commit
git add fileName
commit the files you staged
git commit -m "my message"
Upvotes: 0
Reputation: 3945
To stage all the files for commit from root of your repository you execute git add .
There are following 2 ways by which you can stage specific files for commit:
Go to the directory from which files are to be staged for commit e.g. C:\git\repository\{path-to-directory}
and execute git add .
Stage files one by one from the root of your directory as git add {file-path}
Once these files have been staged for commit, you can execute git commit -m
. This will commit only 2 staged files.
Upvotes: 0
Reputation: 366
The equivalent in Visual Studio using Git with TFS would be include -> staged.
Here's the link to Microsoft's documentation.
Upvotes: 3