简体   繁体   中英

Git branches deleted

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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM