Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git. Rebase local branch atop local master. How do I ignore a single files changes?

Tags:

git

rebase

With Git I am on a branch. I am rebasing the branch atop master. There is a conflict that I want to resolve by ignoring the branches version and accepting master's version. How do I indicate I want to use master's version of the file during the rebase-ing.

Thanks,
Doug

like image 940
dugla Avatar asked Sep 24 '14 12:09

dugla


1 Answers

git checkout --ours <path-to-file> is the command you are looking for.

It will checkout the master version of the file which you then can add to the index (to mark the conflict resolved) and continue your rebase.

You can take a look at the checkout documentation for more information.

See the comment under --merge as to why you need to use --ours and not --theirs.

like image 171
Sascha Wolf Avatar answered Oct 02 '22 06:10

Sascha Wolf