使用git進行系統開發時,剛開始採用主幹master,在項目更新頻繁的狀況下,就須要新建分支進行開發,每次將新的分支branch提交到gitee上,開發完畢時新分支合併到主幹master上。git
從已有的分支建立新的分支(如從master分支),建立一個test分支git branch test
建立新分支git checkout test
切換到新分支
上面命令等用於git checkout -b test
spa
git branch
*表示在當前分支git push origin test
git pull origin test
git branch --set-upstream-to=origin/test
git branch --unset-upstream master
在分支test上開發完成後,須要合併到主幹master.net
git checkout master
git push origin
再次上傳git push --set-upstream origin master
報錯以下:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/tahara/blue...'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
出現這個問題是由於gitee中的一些文件不在本地代碼目錄中,能夠經過以下命令進行代碼合併code
git pull --rebase origin master
blog
git branch -d test
git branch -D test
刪除git push origin --delete test