git 远程分支

...

git push origin :<branchname> 删除了远程分支

git remote prune origin 删除远程上不存在的分支的引用

git fetch <remote> --prune 这将删除所有过时的远程跟踪分支。该命令的缩写是: git fetch <remote> -p

要删除特定的本地远程跟踪分支,可以使用以下命令: git branch --delete --remotes <remote>/<branch> 该命令的缩写是: gitbranch -dr <remote>/<branch>

请注意,如果你使用 git push 从命令行删除远程分支 X,那么它也会删除本地远程跟踪分支 origin/X,因此无需使用 git fetch -prune 或 git fetch –p 删除过时的远程跟踪分支。

 

The short answers
If you want more detailed explanations of the following commands, then see the long answers in the next section.

Deleting a remote branch
git push origin --delete <branch> # Git version 1.7.0 or newer
git push origin -d <branch> # Shorter version (Git 1.7.0 or newer)
git push origin :<branch> # Git versions older than 1.7.0
Deleting a local branch
git branch --delete <branch>
git branch -d <branch> # Shorter version
git branch -D <branch> # Force-delete un-merged branches
Deleting a local remote-tracking branch
git branch --delete --remotes <remote>/<branch>
git branch -dr <remote>/<branch> # Shorter

git fetch <remote> --prune # Delete multiple obsolete remote-tracking branches
git fetch <remote> -p # Shorter
========================================================

 

 

posted @ 2021-07-09 15:01  voh99800  阅读(52)  评论(0编辑  收藏  举报