How to recover the deleted branch in git?

Simply push the local deleted branch. If that is not present on local and then follow the these steps.

Yes, it’s easy to restore a deleted branch from git.

Create a new branch:

git checkout -b recover_branch
Use git reflog to view information in your reflog:

git reflog
Find the entry that shows HEAD@{0}: this is your HEAD commit for that branch. Note the commit id and use it in the following command:

git merge
You might also be able to use:

git branch

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s