Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Arthurial
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 21, 2015

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

16 votes
Arthurial
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 22, 2015

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.

 

Adrià Marí
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 18, 2016

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

David Avila
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 10, 2017

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

dascoba
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 19, 2017

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

SynthWeaver
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 21, 2017

THANKS

Sandeep Mamdikar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 11, 2017

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

Madhur Bhargava
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 30, 2017

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

Michael_Kushniriov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 4, 2018

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).

RamyaSri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 2, 2018

Thank you so much @Arthurial.. Your answer saved me a lot .. 

MinhHieuDL
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 6, 2020

Thank you, your answer saved my day!

eliteforcevn
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 19, 2020

Thank you you saved my works

0 votes
Michael Litner May 15, 2018

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

0 votes
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 22, 2015

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events