我是Git的新手,並且無法理解如何使用Git。我一直在使用CVS,所以通過一些Git的學習曲線。這裏是我所有嘗試的如何做正確的git合併/拉:你還沒有結束你的合併(MERGE_HEAD存在)
現在我只更改了兩個文件PromoServiceImpl.java和build.sql。然而,融合問題已經從「產品」分支變成了現實。
您看到的剩餘文件(如ApiServiceImpl.java等)是來自其他用戶的更改,但我不確定此處的表示是否表明我已更改它們。 Prob它在早期的拉命令期間被合併,現在它期望我提交它們?
不管什麼是(甚至在某些谷歌搜索)我遵守命令的流量我看到以下錯誤:
You have not concluded your merge (MERGE_HEAD exists) Please, commit your changes before you can merge.
這裏是我遵循和輸出的命令序列(試圖使它漂亮通過插入新行以供大家閱讀)。即使在重新從庫中進行修改之後,這個錯誤也會回來,所以我確信我在做一些錯誤的事情,而不是使用git的一些問題。
[email protected]:~/git/TryGit$ gs
# On branch product
# Your branch is ahead of 'origin/product' by 1 commit.
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: TryGitServices/src/main/java/com/TryGit/services/promo/impl/PromoServiceImpl.java
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Adding
no changes added to commit (use "git add" and/or "git commit -a")
[email protected]:~/git/TryGit$ git pull origin product
From ssh://192.168.2.251/TryGit
* branch product -> FETCH_HEAD
Auto-merging TryGitResources/build/build.sql
CONFLICT (content): Merge conflict in TryGitResources/build/build.sql
Automatic merge failed; fix conflicts and then commit the result.
[email protected]:~/git/TryGit$ gs
# On branch product
# Your branch is ahead of 'origin/product' by 1 commit.
#
# Changes to be committed:
#
# modified: TryGitCore/src/main/java/com/TryGit/core/api/binding.xml
# modified: TryGitServices/src/main/java/com/TryGit/services/api/impl/ApiServiceImpl.java
# modified: TryGitServices/src/main/java/com/TryGit/services/common/impl/StartupServiceImpl.java
# modified: TryGitWeb/src/main/webapp/WEB-INF/wsdl/TryGit.wsdl
# modified: TryGitWeb/src/main/webapp/static/css/TryGit/homeDeal.css
# modified: TryGitWeb/src/main/webapp/static/css/TryGit/TryGit.css
# modified: TryGitWeb/src/main/webapp/static/img/TryGit/sprite/TryGit.png
# modified: TryGitWeb/src/main/webapp/views/admin/createPromoCode.jsp
# modified: TryGitWeb/src/main/webapp/views/admin/product/productAdmin.jsp
# modified: TryGitWeb/src/main/webapp/views/deal/homePage.jsp
#
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: TryGitResources/build/build.sql
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: TryGitServices/src/main/java/com/TryGit/services/promo/impl/PromoServiceImpl.java
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Adding
[email protected]:~/git/TryGit$ git reset TryGitResources/build/build.sql
Unstaged changes after reset:
M TryGitResources/build/build.sql
M TryGitServices/src/main/java/com/TryGit/services/promo/impl/PromoServiceImpl.java
[email protected]:~/git/TryGit$ gs
# On branch product
# Your branch is ahead of 'origin/product' by 1 commit.
#
# Changes to be committed:
#
# modified: TryGitCore/src/main/java/com/TryGit/core/api/binding.xml
# modified: TryGitResources/build/build.sql
# modified: TryGitServices/src/main/java/com/TryGit/services/api/impl/ApiServiceImpl.java
# modified: TryGitServices/src/main/java/com/TryGit/services/common/impl/StartupServiceImpl.java
# modified: TryGitWeb/src/main/webapp/WEB-INF/wsdl/TryGit.wsdl
# modified: TryGitWeb/src/main/webapp/static/css/TryGit/homeDeal.css
# modified: TryGitWeb/src/main/webapp/static/css/TryGit/TryGit.css
# modified: TryGitWeb/src/main/webapp/static/img/TryGit/sprite/TryGit.png
# modified: TryGitWeb/src/main/webapp/views/admin/createPromoCode.jsp
# modified: TryGitWeb/src/main/webapp/views/admin/product/productAdmin.jsp
# modified: TryGitWeb/src/main/webapp/views/deal/homePage.jsp
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: TryGitResources/build/build.sql
# modified: TryGitServices/src/main/java/com/TryGit/services/promo/impl/PromoServiceImpl.java
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Adding
[email protected]:~/git/TryGit$ git stash
Saved working directory and index state WIP on product: b8bb080 changing build.sql for RBT task
HEAD is now at b8bb080 changing build.sql for RBT task
[email protected]:~/git/TryGit$ gs
# On branch product
# Your branch is ahead of 'origin/product' by 1 commit.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Adding
nothing added to commit but untracked files present (use "git add" to track)
[email protected]:~/git/TryGit$ git reset Adding
[email protected]:~/git/TryGit$ git reset Adding
[email protected]:~/git/TryGit$ gs
# On branch product
# Your branch is ahead of 'origin/product' by 1 commit.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Adding
nothing added to commit but untracked files present (use "git add" to track)
[email protected]:~/git/TryGit$ git rm Adding
fatal: pathspec 'Adding' did not match any files
[email protected]:~/git/TryGit$ man git rm
[email protected]:~/git/TryGit$ git rm Adding
fatal: pathspec 'Adding' did not match any files
[email protected]:~/git/TryGit$ gs
# On branch product
# Your branch is ahead of 'origin/product' by 1 commit.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Adding
nothing added to commit but untracked files present (use "git add" to track)
[email protected]:~/git/TryGit$ git pull origin product
remote: Counting objects: 566, done.
remote: Compressing objects: 100% (316/316), done.
remote: Total 386 (delta 207), reused 0 (delta 0)
Receiving objects: 100% (386/386), 203.81 KiB, done.
Resolving deltas: 100% (207/207), completed with 56 local objects.
From ssh://192.168.2.251/TryGit
* branch product -> FETCH_HEAD
Auto-merging TryGitResources/build/build.sql
CONFLICT (content): Merge conflict in TryGitResources/build/build.sql
Automatic merge failed; fix conflicts and then commit the result.
[email protected]:~/git/TryGit$ git pull origin product
M TryGitCore/src/main/java/com/TryGit/core/api/binding.xml
U TryGitResources/build/build.sql
M TryGitServices/src/main/java/com/TryGit/services/api/impl/ApiServiceImpl.java
M TryGitServices/src/main/java/com/TryGit/services/common/impl/StartupServiceImpl.java
M TryGitWeb/src/main/webapp/WEB-INF/wsdl/TryGit.wsdl
M TryGitWeb/src/main/webapp/static/css/TryGit/homeDeal.css
M TryGitWeb/src/main/webapp/static/css/TryGit/TryGit.css
M TryGitWeb/src/main/webapp/static/img/TryGit/sprite/TryGit.png
M TryGitWeb/src/main/webapp/views/admin/createPromoCode.jsp
M TryGitWeb/src/main/webapp/views/admin/product/productAdmin.jsp
M TryGitWeb/src/main/webapp/views/deal/homePage.jsp
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
[email protected]:~/git/TryGit$ git add TryGitResources/build/build.sql
[email protected]:~/git/TryGit$ git pull origin product
You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
[email protected]:~/git/TryGit$ gs
# On branch product
# Your branch is ahead of 'origin/product' by 1 commit.
#
# Changes to be committed:
#
# modified: TryGitCore/src/main/java/com/TryGit/core/api/binding.xml
# modified: TryGitResources/build/build.sql
# modified: TryGitServices/src/main/java/com/TryGit/services/api/impl/ApiServiceImpl.java
# modified: TryGitServices/src/main/java/com/TryGit/services/common/impl/StartupServiceImpl.java
# modified: TryGitWeb/src/main/webapp/WEB-INF/wsdl/TryGit.wsdl
# modified: TryGitWeb/src/main/webapp/static/css/TryGit/homeDeal.css
# modified: TryGitWeb/src/main/webapp/static/css/TryGit/TryGit.css
# modified: TryGitWeb/src/main/webapp/static/img/TryGit/sprite/TryGit.png
# modified: TryGitWeb/src/main/webapp/views/admin/createPromoCode.jsp
# modified: TryGitWeb/src/main/webapp/views/admin/product/productAdmin.jsp
# modified: TryGitWeb/src/main/webapp/views/deal/homePage.jsp
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Adding
[email protected]:~/git/TryGit$ git pull origin product
You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
[email protected]:~/git/TryGit$
快速的建議:忘掉‘混帳拉’你不需要它,它的。最好的方法是在git中迷路,因爲它只是一個合併後的git fetch,所以使用這兩個!你可以(當然!)想看看你實際要合併的內容。在我看來,git pull是一個可能非常混亂的捷徑 – 2011-12-14 16:10:36