--- title: git更新/協作篇 tags: git 相關 --- ## <font color=red>**git協作** </font> ``` 協作篇: git clone + 複製新專案下來 git pll 更新目前專案 git push 將專案推上去 git fetch orign + 分支名 (指令:git fetch => 可取得遠端的分支(但是尚未建立本地develop分支))(rebase後的檔案推上去) ``` 危機感: 0.先確定是否有clone過專案下來。(製作時都開新分支製作) 1.git fetch origin develop: 將目前本機的檔案與遠端的檔案拉下來進行更新 2.git pull origin develop 3.git checkout feat/oauth(要的分支名) 4.git rebase develope (會顯示,已是最新的) 5. (可能會有衝突,在本機解除,才利於遠端上運作。) 6.git push origin feat/oauth -f (確認衝突解完後推上專案。) (當你很確定於此分支是最新的,才可以使用 -f 進行強推) 隨時要 git status進行提交的確認 。 ![](https://i.imgur.com/J83Mb9P.png) ![](https://i.imgur.com/B53hfO3.png) ![](https://i.imgur.com/KudSwGG.png) --- git rebase -v (分支) 合併commit git cherry-pick (接舊的commit的就好) git rebase (cherry-pick 比較)