git 相關操作

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

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容