clone代碼git
// --recursive參數表明將子模塊一塊兒clone下來 git clone --recursive git@gitlab.code.anzogame.com:app/test.git
查看狀態app
git status
查看分支gitlab
//只能看本地分支 git branch //查看本地和遠程分支,前提是已經git pull了 git branch -a
分支建立學習
//-b參數表明建立成功後自動切換到該分支 git checkout -b dev
切換分支網站
//若是本地以及存在dev分支 git checkout dev //若是本地沒有dev分支,遠程倉庫上有dev分支 git checkout -b dev origin/dev [注意]切換到到遠程分支後,第一次pull或者push可能會報錯 There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> dev 此時根據提示執行一下命令就能夠了 git branch --set-upstream-to=origin/dev dev
更新代碼this
git pull
提交代碼code
//主要用於把咱們要提交的文件的信息添加到索引庫中 git add . //git將依據索引庫中的內容來進行文件的提交 git commit -m "commit message" //前兩個的合併 git commit -am "commit message"
推送到遠程倉庫orm
git push //若是遠程有該分支,就提交代碼到指定dev分支 //若是遠程沒有該分支,就建立該分支,並將本地內容所有push上去 git push origin dev
代碼合併索引
//將dev分支上的代碼合併到當前分支 git merge dev
最後,不得不說這個網站是學習Git的最佳地方 http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 https://git-scm.com/book/zh/v2/ci