Every time I update one of my git repo and fetch a new branch or commits I want to replace two of the new files with the ones in a specific branch.
I know that I can do that with checkout but...
What is the difference between
git checkout wanted_branch file_wanted
and
git checkout --merge wanted_branch file_wanted
?
In the form that you are mentioning, there is really no difference between the two and the --merge
is superfluous.
--merge
option is mainly used when you are switching branches and you have local modifications in your working directory, so that rather than just saying you cannot switch branches, you can make git to attempt to do a three-way merge on the modifications and present you with checked out branch with or without the conflicts.
Also, when you do git checkout --merge -- file
during conflict, you get back the conflicted merge in file
( from the index)
The above two are the uses for --merge
and in the form you mentioned, it is not different from git checkout some_branch -- file
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