Recover a Deleted Git Branch with Reflog

Recover a Deleted Git Branch with Reflog

In this quick tip, we'll see how to recover a removed Git branch using Reflog

First, run the following command to display the SHA1 of your commits:

$ git reflog

Look for the SHA1 code of your deleted branch and then run the following command:

$ git branch <sha1>

This will recover your deleted branch.

✋If you have any questions about this article, ask them in our GitHub Discussions 👈 community. You can also Gitter

✋ Want to master Angular 14? Read our angular tutorial and join our #DailyAngularChallenge where we learn to build components, directives, services, pipes and complete web, mobile, and desktop applications with latest Angular version.

✋ Make sure to join our Angular 14 Dev Community 👈 to discuss anything related to Angular development.

❤️ Like our page and subscribe to our feed for updates!