删除远程分支
git branch -r -d origin/<branch_name>
git push origin –delete <branch_name>
git push origin :<branch_name> // 推送空分支删除
创建远程分支
git push origin <local_branch_name>:<remote_branch_name>
显示本地 tag
git tag
<tag_name>
删除本地tag
git tag -d <tag_name>
删除远程tag
git push origin –delete tag <tag_name>;
git push origin :refs/tags/<tag_name> // 推送空分支删除
把本地tag推送到远程
git push –tags
获取远程
tag git fetch origin tag <tag_name>
删除不存在对应远程分支的本地分支
1 2 3 4 5 6 7 8 9 10 11 12 |
# git remote show origin * remote origin Fetch URL: git@github.com:xxx/xxx.git Push URL: git@github.com:xxx/xxx.git HEAD branch: master Remote branches: master tracked refs/remotes/origin/b1 stale (use 'git remote prune' to remove) Local branch configured for 'git pull': master merges with remote master Local ref configured for 'git push': master pushes to master (up to date) |
这时候能够看到b1是stale的, git remote prune origin 可以将其从本地版本库中去除。
更简单的方法是使用这个命令,它在fetch之后删除掉没有与远程分支对应的本地分支:
git fetch -p
- 本文固定链接: http://www.wy182000.com/2013/06/24/git-远程删除-tags-branchs/
- 转载请注明: wy182000 于 Studio 发表