skip to Main Content
I Have Removed Wrong Branch (with Force) By Mistake, What Now?

I have removed wrong branch (with force) by mistake, what now?

Lets create repository to experiment with:

Graphically git repository will look like this:


We are currently on master branch. Let’s say we remove (by mistake) feature/Democratic branch with force (cause branch is not merged into master).

To revert that change we need to find SHA1 of last commit made on that branch.

Where to look? If you use terminal look at branch deleting command.


And in this you can use short SHA1 fee449c to bring back deleted branch.

What to do when you have closed terminal or you use GUI to manage your repository?

We need to use time-machine for git


from that you can deduce last commit from feature/Democratic branch

Back To Top