分支
- 查看本地分支
git branch
- 查看本地和遠(yuǎn)程分支
git branch -a
git branch --all
- 更新本地的遠(yuǎn)程分支列表
git remote update origin --prune
git remote update origin -p
git fetch -p
- 刪除本地分支
git branch --delete <branchName>
git branch -d <branchName>
- 刪除遠(yuǎn)程分支
git push origin --delete <branchName>
- 切換分支
git checkout <branchName>
- 創(chuàng)建本地分支
git branch <branchName>
- 創(chuàng)建并拉取遠(yuǎn)程分支到本地(本地不存在時(shí))
git checkout -b <branch> origin/<remoteBranch>
本地儲(chǔ)藏
- 儲(chǔ)藏
git stash
- 查看現(xiàn)有的儲(chǔ)藏列表
git stash list
-
使用儲(chǔ)藏的
- 使用最近的儲(chǔ)藏并應(yīng)用
git stash apply- 使用指定的儲(chǔ)藏
git stash apply stash@{1}- 使用儲(chǔ)藏,同時(shí)暫存的也保持一致
git stash apply --index 刪除儲(chǔ)藏指定的列表
git stash drop stash@{0}
- 應(yīng)用并刪除
git stash pop
關(guān)聯(lián)遠(yuǎn)程分支地址
- 關(guān)聯(lián)遠(yuǎn)程分支
git remote add origin git@xxxx:xxxx.git
- 關(guān)聯(lián)后,第一次推送master分支的所有內(nèi)容
git push -u origin master
- 此后,每次本地提交
git push origin master