在gitee上新建立項目後,將本地的項目提交到git上去git
git init
touch README.md
git add .
git commit -m 'first commit'
git remote add origin https://gitee.com/abc/abc.git
git push -u origin master
將項目push到倉庫的時候,由於倉庫中的項目非空,因此會報錯:fetch
To gitee.com:abc/abc.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'git@gitee.com:abc/abc.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
因此先pull項目spa
git pull
git push -u origin master
報錯:code
To gitee.com:abc/abc.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@gitee.com:abc/abc.git' 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.
提示版本落後於線上的項目,線上的內容是沒有用的,因此強制推送一次blog
git push -u -f origin master
成功後建立多個分支:ip
查看本地分支和遠程分支rem
git branch
git branch -r
建立分支it
git checkout -b v1.0 origin/mastergit push origin HEAD -u