-b創(chuàng)建本地的新分支,-u origin創(chuàng)建倉庫新分支,并把本地的分支推送到云端
一之宿、https://blog.csdn.net/weixin_33699914/article/details/91314505
二捻脖、https://blog.csdn.net/lincyang/article/details/21519333
三、切換到分支報(bào)錯:Your local changes to the following files would be overwritten by checkout:
? ? ? 解決辦法:? ? https://blog.csdn.net/qq_32452623/article/details/75645578
1. git add .
2. git commit -m 'XXX'
3. git push
提交push 報(bào)錯:
$ git push origin master
Tohttps://gitee.com/xxx/******.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/xxx/******.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.
這是因?yàn)檫h(yuǎn)程庫里面有個文件停忿,但是本地沒有這個文件驾讲,完全提交上去會覆蓋之前的文件(通常是因?yàn)檫h(yuǎn)程庫自動生成了一個REMAND.MD的文件原因,但是本地沒有add到這個文件)
我們直接強(qiáng)制push 下就可以了:
$ git push -u origin master -f