刪除遠(yuǎn)程分支
git push origin --delete <branchName>
創(chuàng)建本地分支
git checkout -b iss53
git branch iss53
git checkout iss53
刪除本地分支:
git branch -d iss53
查看remote地址,遠(yuǎn)程分支,還有本地分支與之相對應(yīng)關(guān)系等信息
git remote show origin?
基于分支創(chuàng)建分支
git checkout -b <branch> --track <origin>/<branch>?
8.如果本地新建了一個分支 branch_name,但是在遠(yuǎn)程沒有。
這時候?push 和 pull?指令就無法確定該跟蹤誰,一般來說我們都會使其跟蹤遠(yuǎn)程同名分支,所以可以利用?git push?--set-upstream origin?branch_name?,這樣就可以自動在遠(yuǎn)程創(chuàng)建一個?branch_name?分支,然后本地分支會?track?該分支。后面再對該分支使用 push 和 pull 就自動同步。
----
git cherry-pick
1.copy commit
2.git checkout target_branch
3.git cherry-pick {commitId}?
打tag
git tag -a v1.4 -m 'my version 1.4'
將tag推到遠(yuǎn)程庫
git push origin v1.4
刪除本地tag
git?tag?-d?標(biāo)簽名??
刪除遠(yuǎn)程tag
git?push?origin?:refs/tags/標(biāo)簽名??
基于tag創(chuàng)建分支:
1執(zhí)行:Git origin fetch 獲得最新.
2.通過:git branch會根據(jù)tag創(chuàng)建新的分支.
例如:git branch newbranch v1.0 . 會以tag v1.0創(chuàng)建新的分支newbranch;
3.可以通過git checkout newbranch 切換到新的分支.
4.通過 git push origin newbranch 把本地創(chuàng)建的分支提交到遠(yuǎn)程倉庫.
添加本地忽略文件
git update-index --assume-unchanged FILENAME
恢復(fù)本地忽略文件
git update-index --no-assume-unchanged FILENAME
查看本地未忽略問價列表
git ls-files -v|grep h
關(guān)聯(lián)本地分支到遠(yuǎn)程分支
?git branch --set-upstream-to=origin/master master