Git switches to the specified commit and commit and deletes the branch

The first is to find the specified commit ID through git log --pretty=oneline

 git checkout  4da58520

 The prompt is not on any branch, you need to create a new branch to associate changes git checkout -b new_commit_branch

 push changes

 git push

 At this point the new branch falls back to the specified commit ID, and we can do our thing.

After use, you need to delete this branch to destroy the corpse

switch to other branch

local git checkout new_branch

delete temporary branch

git branch -d new_commit_branch

 Delete the remote branch git push origin --delete origin/new_commit_branch

 Check  

Call it a day.

Guess you like

Origin blog.csdn.net/bruce_van/article/details/131369537