Search code examples
gitrebase

During a git rebase, how can I keep the original and discard changes?


I am doing a rebase and have come to a file with conflicts, but these conflicts are basically impossible to resolve. The best way to deal with the situation would be to tell git to ignore the changes and keep the original. I can then go back and re-edit the file to make the changes.

How can I do this?


Solution

  • If you have encountered a merge conflict you can do this

    git checkout --ours file
    

    or the other way round

    git checkout --theirs file