git 項目切換分支 命令


在項目開發總,一般都會用到git管理工具,有的公司可能還是用的svn;不管怎么樣。用的順手就行;

來說下git 的基本使用

git clone + 項目地址鏈接; 可以把項目克隆到本地;

然后一般順序是

$ cd gap-official-site  // 這里是進入到項目的文件夾中
// 查看分支 這里是看的本地的分支
$ git branch
* master  

 接着是查看遠程分支

 

$ git branch -a  // 查看遠程分支
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/cherry-pick-2bf56ac3
  remotes/origin/cherry-pick-42525e75
  remotes/origin/cherry-pick-939d6f79
  remotes/origin/cherry-pick-966bced7
  remotes/origin/cherry-pick-eda5f5ca
  remotes/origin/cherry-pick-f6dcc5e6
  remotes/origin/cherry-pick-f7232894
  remotes/origin/feature-0.0.1
  remotes/origin/feature-0.0.10
  remotes/origin/feature-0.0.2
  remotes/origin/feature-0.0.3
  remotes/origin/feature-0.0.4
  remotes/origin/feature-0.0.5
  remotes/origin/feature-0.0.6
  remotes/origin/feature-0.0.7
  remotes/origin/feature-0.0.8
  remotes/origin/master

 然后切換到當前正在開發的分支下

1 $ git checkout -b feature-0.0.10 origin/feature-0.0.10
2 Switched to a new branch 'feature-0.0.10'
3 Branch 'feature-0.0.10' set up to track remote branch 'feature-0.0.10' from 'origin'.

顯示上面的內容就表示已經切換成功了!

不放心再用命令查看下你當前所在的分支

$ git branch
* feature-0.0.10
  master

 現在可以開始 修 bug 了 哈!  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM