git 分支 branch 操做

建立分支git

git branch test: 基於當前commit建立test分支。.git/HEAD 文件中記錄了當前分支名字。

刪除分支服務器

git branch -d test:刪除本地test分支

git branch -D test: test分支尚未合入當前分支,因此要用-D參數才能刪掉。

git push origin --delete test 刪除遠程test分支

git push origin :test 刪除遠程test分支

查看分支fetch

git branch 列出當前分支清單

git branch -a 查看遠程分支和本地分支

git branch -v 查看各個分支最後一個提交信息

git branch --merged 查看哪些分支已經合併入當前分支

拉取分支 spa

git fetch origin 同步遠程服務器的數據到本地

git checkout -b test origin/test_remote 將遠程分支test_remote拉取下來到本地test分支

git checkout test 將遠程分支test拉取下來到本地test分支

git pull test從遠程分支test 中checkout下來的本地分支test成爲跟蹤分支,使用git pull或者git push就會操做到對應的遠程分支test
相關文章
相關標籤/搜索