Entire Commit Lost in SourceTree after Pull with rebase instead of merge

Hello,

I'm trying to recover a commit that was lost after an unsuccessful merge after pulling (with the rebase instead of merge option checked). Admittedly I'm not entirely sure about this process, as I was instructed to use it to avoid large merged commits, and that's why I'm in this mess.

After there was a conflict, I clicked 'Continue Rebase' by mistake instead of Abort, and consequently it has wiped out a lot of work. I'm using SourceTree's inbuilt version of GIT. 

I would appreciate your assistance in recovering my work, since the commit is now entirely gone from this GUI's history.

Thank you,

3 answers

Thanks Balazs. Luckily git hadn't deleted the commit. I managed to find and recover it using the terminal and perform a hard reset to restore my lost work.

For reference:

  1. Open the Terminal in the Actions menu.
  2. Type git reflog - this will display your recent history with ids for each git action.
  3. Type git reset --hard your_lost_commit's_id - but this will wipe out all changes since that commit.

 

This saved 2 very productive hours of work and made my day. Thank you.

This happened to me today and this answer fixed it for me.

This saved 2 days of work that I thought was lost.. Thanks!!!

This saved 2 days of work that I thought was lost.. Thanks!!!

This saved me and my colleague from couple of hours of work and a million tears

by the way if there are other commit maid after your lost commit, you can create a branch from this one and that way "clone" the existing branch. Then follow the steps suggested by Richard, and have your branch safe and sound with new name (of the newly created branch).

Check if you have .orig, .bak or similar files left by your merge tool. If yes, you can use these. If not, there is not much you can do, unless the server or some other person's clone has the original commit.

0 vote

Thank you. This saved half a day of my work!!!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

560 views 1 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you