tag
删除本地tag
git tag -d v1.0.0 // 比如tag是v1.0.0
git push origin :refs/tags/v1.0.0 // 删除远程tag
git show v1.0.6 // 显示v1.0.6的详情(注释等)
获取某tag下的代码(会自动创建一个分支)
git checkout -b branch_name tag_name
.gitignore不生效
原因:已经被加入了版本控制
git rm -r --cached 路径文件(类似.gitignore中的文件路径,如 Pacs.xcworkspace/xcuserdata/surui.xcuserdatad)
git clean -fd // 删除untrack文件
branch
// 将test分支合并到master分支中
1.切换到主分支
git checkot master
2.合并分支
git merge test
分支常用命令
git branch test // 新建test分支
git checkout -b test // 新建test分支并切换到新建分支
git branch // 查看分支
git push origin test // 分支push到远程
git branch -m test test2 // 将分支test更名为test2
git branch -r // 查看远程分支
git branch -a // 查看所有分支
git push origin --delete test // 删除远程分支
git push origin BRANCH // BRANCH是你远程分支的名字
git branch -d badgebutton // 删除本地分支
新建分支后,提交出错
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
// 最新使用方式
git branch --set-upstream-to=origin/myBranch1