[Git / SVN] git delete delete remote branch and the local branch

introduction:

When switching branch command wrong, git checkout is not followed by the name of the branch with the results git status, delete a lot of files, direct cold sweats, git add, after the discovery of local and remote indeed commit to delete a lot of files, before also had a , it was a catalog for a new re-drawing code. . . The trouble is

The situation told colleagues gave me suggestions, delete the branch, pull back, and began this operation.

Specific operation:

I am now on dev20181018 branch, branch want to delete dev20181018


 1 先切换到别的分支: git checkout dev20180927

 2 删除本地分支: git branch -d dev20181018

 3 如果删除不了可以强制删除,git branch -D dev20181018

 4 有必要的情况下,删除远程分支:git push origin --delete dev20181018

 5 在从公用的仓库fetch代码:git fetch origin dev20181018:dev20181018

 6 然后切换分支即可:git checkout dev20181018

Note: The above operation is to remove the individual local and personal remote branch, if you delete only individual local, omit step 4

Published 134 original articles · won praise 80 · views 30000 +

Guess you like

Origin blog.csdn.net/Umbrella_Um/article/details/104524428
Recommended