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?
Asked
Active
Viewed 48 times
0

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

Mahesh Kurade
- 21
- 2
-
2just revert back to a state when the folder was present, then delete it as necessary and continue – Anantha Raju C Oct 08 '15 at 09:24
2 Answers
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