【Git】在本地建立git庫管理自己的程式碼
阿新 • • 發佈:2018-12-17
1、建立本地庫
git init . 新建庫 git config --global user.email "[email protected]" git config --global user.name “laoer” git config --global core.editor vim //將預設編輯器由nano更改為vim
2、提交
2.1 git add . 將當前目錄下所有檔案新增到提交緩衝區 2.2 git commit 將提交緩衝區中的資料提交到庫中 如果沒有將預設編輯器修改為vim,則進入nano文字編輯器(類似vim模式)後,填寫修改記錄,按下Ctrl+x,輸入Y儲存,然後回車退出 或者使用 git commit -m “提交修改資訊”
3、分支操作
3.1 建立分支 git branch <name> git checkout <name> 以上兩條等同於: git checkout -b <name>
3.2 切換分支 git checkout master //切換到master分支
3.3 合併分支 git checkout master git merge <name>
3.4 解決衝突 <合併時出現這個資訊表示需要合併衝突:Automatic merge failed; fix conflicts and then commit the result.> git status 視覺化解決衝突: git mergetool
3.5 刪除分支 git branch -d <name>