How to retract the newly deleted branch in git: 1. Use the "git remote prune" command to view the deleted branch; 2. Use the "git reflog" command to find the "commit SHA" of the last commit record of the deleted branch. "value; 3. Use the "git checkout -b dev commit SHA value" command to restore the deleted branch.
The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.
There are two possibilities for branch deletion, either by deleting it with a command, which can be seen with git log; or by deleting it in a browser When merging branches, check the option to delete the source branch after merging.
1, check the deleted branch
git remote prune --dry-run origin
The deleted branch is
2, find the deleted branch Delete the commit SHA value of the last commit record of the branch
git reflog
The commit SHA value of the last commit is 5f8fe57
3, restore the branch
Use command to restore;
git checkout -b dev 5f8fe57
Recommended learning: "Git Tutorial"
The above is the detailed content of How to withdraw a newly deleted branch in git. For more information, please follow other related articles on the PHP Chinese website!