OnedayLiu / Blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Git 常用命令

OnedayLiu opened this issue · comments

本地分支关联远程分支 详细

Given a branch foo and a remote upstream:
As of Git 1.8.0:
git branch -u upstream/foo

删除分支 详细

删除本地分支
git branch -d <branch>
强制删除本地分支
git branch -D <branch>
删除远程分支
git push origin --delete <branch>

创建分支

创建并查看 <new-branch>-b 选项是一个方便的标记,告诉 Git 在运行 git checkout <new-branch> 之前运行 git branch <new-branch>
git checkout -b <new-branch>

Tag

git tag <tagname>
  • 将 tag 推送到远程
git push origin <tagname>