Reputation: 19120
I'm using the TortoiseGit client on Win XP. In a particular folder, I have 3 modified files, whose modifications I wish to trash. In other words, I want to check out the latest versions of these three files from the remote repository. Note that there is another modified file in the same directory that I wish to leave as is. How do I get the latest version of only these 3 files?
Thanks - Dave
Upvotes: 6
Views: 7436
Reputation: 8310
From the project root invoke the context-menu (Click right-mouse-button assuming you are right-handed ;-).
Select TortoiseGit > Revert...
The Revert dialog will show all files you in your repository that you have modified. You can choose the ones you wish to revert by selecting the check box and then pressing OK.
This brings the selected files back to their original state.
You can then get the latest versions of these files from the shared repository using the Pull... operation from the TortoiseGit context menu (Of course you might wish to commit/stash other changes you have locally).
Upvotes: 2
Reputation: 392921
A checkout with pathnames does not affect HEAD:
git checkout origin/master -- file1 path/file2 path/file3
Assuming default upstream remote/branch names (e.g. after a git clone)
Note that the three named files will be overwritten without warning. Any uncommitted local changes to these named files will be lost.
Upvotes: 8