0

I was having three branches master, b1 and b2. I was working on branch b2. There was a common folder which was present in all branches. While deleting the folder I selected, delete from other branch also. This option deleted folder as well and other two branches(master and b1) from the git server. Anyone know how I can get back master and b1 branch back?

Anantha Raju C
  • 1,780
  • 12
  • 25
  • 35

2 Answers2

0

You can use git reflog to find the SHA1 of the last commit of the branch. From that point, you can recreate a branch using

git branch branchName

Hexana
  • 1,095
  • 2
  • 12
  • 35
0

The git revert command undoes a committed snapshot. But, instead of removing the commit from the project history, it figures out how to undo the changes introduced by the commit and appends a new commit with the resulting content. This prevents Git from losing history, which is important for the integrity of your revision history and for reliable collaboration.

Usage:

git revert <commit>

Generate a new commit that undoes all of the changes introduced in , then apply it to the current branch.

Josip Ivic
  • 3,639
  • 9
  • 39
  • 57