Skip to content

Instantly share code, notes, and snippets.

@umayr
Created April 1, 2016 11:41
Show Gist options
  • Save umayr/b95e11d5f22c24a872ef95d215ba2ab1 to your computer and use it in GitHub Desktop.
Save umayr/b95e11d5f22c24a872ef95d215ba2ab1 to your computer and use it in GitHub Desktop.
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
# Create branch
git branch recovered-branch
# You may want to push that back to remote
git push origin recovered-branch:recovered-branch
@aryanprince
Copy link

ty king, saved me big time! <3

@vanderlin
Copy link

🙏

@laryhills
Copy link

Still saving lives in 2023

@Geo-W
Copy link

Geo-W commented Jun 1, 2023

lol saving lives here + 1

@blindushii
Copy link

THANK YOU

@ngohuytrieu
Copy link

Thank you so much, you saved me there!

@max-bacon
Copy link

Lifesaver!

@VTwo-Group
Copy link

Thanks.

@Valerii-Synenko
Copy link

Thanx!

@abraham-becker-buildium

Thank you!!

@rdawncisco
Copy link

Just saved me a day's work! Thank you!!

@dlodeprojuicer
Copy link

You deserve a Noble Peace Prize

@himanshuverma560
Copy link

thanks :)

@jdx-code
Copy link

jdx-code commented Nov 5, 2023

Why isn't there a LIKE BUTTON ??

@SeanTolstoyevski
Copy link

I was just shit oneself and now I'm jumping for joy. Thank you.

@yaiir-a
Copy link

yaiir-a commented Jan 6, 2024

hero

@fatimazohora
Copy link

Thanks man! Save my day!

@LeoTN
Copy link

LeoTN commented Jan 12, 2024

Great tutorial bro thanks!

@isakigus
Copy link

I just love you

@jimniels
Copy link

Yet another "thank you / I love you / you are a legend" for this

@imrahup
Copy link

imrahup commented Feb 7, 2024

Thank You so much. Life saver

@dev2GrupoValcas
Copy link

Thank You so much. You are the best

@YohannParis
Copy link

Thank you for this useful snippet!

@Amai-Mask
Copy link

Brotherrrrr, this just saved my arse*

@RafaelRendon
Copy link

HERO! You saved my life! Thank you!

@ViniMakeGames
Copy link

Thanks so much! Saved my life!

@adamwooding
Copy link

Still saving lives in 2024! Thank you so much!

@Darkenis065
Copy link

Thank you bro, you are great.

@ichbinheimdall
Copy link

Thank you, you are great.

@mkaradenizfr
Copy link

Thx man,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment