1. 程式人生 > >githup 首次提交項目及分支 遇到的問題

githup 首次提交項目及分支 遇到的問題

git githup首次提交項目遇到的問題


GITHUP提交項目遇到的問題,會遇到如下問題:


問題1:

命令:git push -u origin master


[email protected] 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


[email protected] 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


[email protected] 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


這就可以了上傳到上去了。


遇到這種問題還有人說是建立分支。

git branch new branch

查看分支是否創建成功

git branch

切換到新的分支

git checkout new branch

切換後可使用 git branch 確認是否切換成功。提交改動到新的分支

git add .
git commit -a



結束!



本文出自 “10093778” 博客,請務必保留此出處http://10103778.blog.51cto.com/10093778/1945467

githup 首次提交項目及分支 遇到的問題