GITHUP提交项目遇到的问题,会遇到如下问题:
问题1:
命令:git push -u origin master
1
2
3
4
5
6
7
8
9
10
|
sdc @DESKTOP -FER9A9K MINGW32 /d/workspace/email-server (master)
$ git push -u origin master:master To 。。。。。。。。。 ! [rejected] master -> master (fetch first)
error: failed to push some refs to '、、、、、、 t'
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=fetch+merge]
git pull --rebase origin master
1
2
3
4
5
6
7
8
9
10
11
12
13
|
sdc @DESKTOP -FER9A9K MINGW32 /d/workspace/email-server (master)
$ git pull --rebase origin master warning: no common commits remote: Counting objects: 17 , done.
remote: Compressing objects: 100 % ( 11 / 11 ), done.
remote: Total 17 (delta 0 ), reused 3 (delta 0 ), pack-reused 0
Unpacking objects: 100 % ( 17 / 17 ), done.
From 。。。。。。。。。。。。。。。。。。 * branch master -> FETCH_HEAD
* [ new branch] master -> origin/master
First, rewinding head to replay your work on top of it... Applying: init commit Using index info to reconstruct a base tree... |
此时再执行语句 git push -u origin master即可完成代码上传到email-server
1
2
3
4
5
6
7
8
9
10
|
sdc @DESKTOP -FER9A9K MINGW32 /d/workspace/email-server (master)
$ git push -u origin master Counting objects: 165 , done.
Delta compression using up to 4 threads.
Compressing objects: 100 % ( 129 / 129 ), done.
Writing objects: 100 % ( 165 / 165 ), 32.45 KiB | 0 bytes/s, done.
Total 165 (delta 75 ), reused 0 (delta 0 )
remote: Resolving deltas: 100 % ( 75 / 75 ), done.
To 。。。。。。。。。。。。。。。。。。。。 06789e0..790d7f6 master -> master
|
这就可以了上传到上去了。
遇到这种问题还有人说是建立分支。
1
|
git branch new branch
|
查看分支是否创建成功
1
|
git branch |
切换到新的分支
1
|
git checkout new branch
|
切换后可使用 git branch 确认是否切换成功。提交改动到新的分支
1
2
|
git add . git commit -a |
结束!
本文转自 豆芽菜橙 51CTO博客,原文链接:http://blog.51cto.com/shangdc/1945467