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
Short Answergit checkout origin/master -- path/to/file // git checkout <local repo name (default is origin)>/<branch name> -- path/to/file will checkout the particular file from the downloaded changes (origin/master).
git checkout origin/master -- path/to/file // git checkout / -- path/to/file will checkout the particular file from the downloaded changes (origin/master). That's it!
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.
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