

# Your branch is behind 'origin/master' by 3 commits, and can be fast-forwarded.Īt this point, I saw the status message changed, so I tried doing a git pull, and that seemed to work: > git pullģ files changed, 20 insertions(+), 4 deletions(-) # and have 1 and 3 different commit(s) each, respectively. # and have 2 and 3 different commit(s) each, respectively. Each time I did that, the message changed by one as you can see below. I then had to type in the same git reset command several more times. # and have 3 and 3 different commit(s) each, respectively. # Your branch and 'origin/master' have diverged, Okay, the answers other people here gave me were close, but it didn't work.

which have changes which have not been added). Resets the index and updates the files in the working tree that are different between and HEAD, but keeps those which are different between the index and working tree (i.e. ORIG_HEAD will point to a commit directly before merge has occurred, so you don't have to hunt for it yourself.Ī further tip is to use the -merge switch instead of -hard since it doesn't reset files unnecessarily: git reset -merge ORIG_HEAD Might yield better results, as it should preserve your changes. To keep them either stash changes away or see -merge option below.Īs suggested below in his answer, in this direct case using: git reset -hard ORIG_HEAD There's also another way: git reset -hard HEAD~1īe aware that any modified and uncommitted/unstashed files will be reset to their unmodified state. Then you can reset it using: git reset -hard commit_sha With git reflog check which commit is one prior the merge ( git reflog will be a better option than git log).
