What i'm looking for is how to checkout a file during a git rebase merge conflict. The situation I ran into today was during a git rebase I had to manually merge the file, and I messed it up. During normal git usage I would just issue a git checkout myfile
, and I tried that but the file was still in the state I left it. What I wanted in this case was the file in its original failed merge state with the conflict markers so I could give it another go. I ended up aborting the rebase and trying it again but I'd like something less drastic. What am I missing?
You can run git rebase --abort to completely undo the rebase. Git will return you to your branch's state as it was before git rebase was called. You can run git rebase --skip to completely skip the commit.
If you have committed changes to a file (i.e. you have run both git add and git commit ), and want to undo those changes, then you can use git reset HEAD~ to undo your commit.
git checkout -m file
To reproduce the automerged result (with conflict markers) of a conflicted path file, using the three versions (base, ours and theirs) recorded in the index. With versions of git up to v1.6.6 (released recently), however, this is only possible until we "git add file" to mark the path as resolved, at which point the three versions are discarded from the index and replaced with the result of the merge.
Ref: http://gitster.livejournal.com/43665.html
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