git 你的分支和'origin/master'有分歧,所有的冲突都解决了,但你仍在合并
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29544660/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Your branch and 'origin/master' have diverged, All conflicts fixed but you are still merging
提问by Sangeeta
i am new to GitHub. and using it via Eclipse we are two people working on a application. i am getting following status when i check git status in Git shell.
我是 GitHub 的新手。并通过 Eclipse 使用它,我们是两个开发应用程序的人。当我在 Git shell 中检查 git status 时,我得到以下状态。
On branch master
Your branch and 'origin/master' have diverged,
and have 2 and 1 different commit each, respectively.
(use "git pull" to merge the remote branch into yours)
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Changes to be committed:
deleted: client/android/BlueDolphinCore/bin/AndroidManifest.xml
deleted: client/android/BlueDolphinCore/bin/R.txt
deleted: client/android/BlueDolphinCore/bin/bluedolphincore.jar
deleted: client/android/BlueDolphinCore/bin/jarlist.cache
deleted: client/android/ChitrguptVersion2/bin/AndroidManifest.xml
deleted: client/android/ChitrguptVersion2/bin/R.txt
deleted: client/android/ChitrguptVersion2/bin/chitrguptversion2.jar
deleted: client/android/ChitrguptVersion2/bin/jarlist.cache
modified: client/android/TaraMachines/AndroidManifest.xml
modified: client/android/TaraMachines/src/com/RareMediaCompany/TaraMachines/Dataclasses/AllConstants.java
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: client/android/BlueDolphinCore/gen/.gitignore
modified: client/android/Devalt/.classpath
modified: client/android/Devalt/project.properties
modified: client/android/Devalt/src/com/RareMediaCompany/Devalt/CreateBatchFragment.java
modified: client/android/Devalt/src/com/RareMediaCompany/Devalt/CreatePlaceActivity.java
modified: client/android/Devalt/src/com/RareMediaCompany/Devalt/Tasks/DownloadTask.java
modified: client/android/DevaltGithubStaging/project.properties
modified: client/android/DevaltTaraAkshar/DevaltGithub/project.properties
modified: client/android/TaraMachines/src/com/RareMediaCompany/TaraMachines/Dataclasses/AllConstants.java
I want to commit my code and sync. but Git is not letting me do so. i have Gitignore file too. but still it is asking me to commit bin and gen folder.
我想提交我的代码并同步。但 Git 不允许我这样做。我也有 Gitignore 文件。但它仍然要求我提交 bin 和 gen 文件夹。
what should i do to ignore these files and sync my workspace. and why i am getting this issue. please explain. Thank you
我该怎么做才能忽略这些文件并同步我的工作区。以及为什么我会遇到这个问题。请解释。谢谢
回答by tupini07
Git is informing you that you are doing a merge and that your branch and the origin
branch have diverged.
Git 会通知您正在进行合并,并且您的分支和origin
分支已经分叉。
- A merge conflict- someone has updated code that you have updated
- Divergence- the tip of your branch is different than the tip of the remote branch
- 合并冲突- 有人更新了您已更新的代码
- 分歧- 你的分支的尖端与远程分支的尖端不同
You want to talk to the developer who committed to master to see how to resolve this, since origin/master may contain important work that shouldn't be lost in this merge conflict.
您想与致力于 master 的开发人员交谈以了解如何解决此问题,因为 origin/master 可能包含不应在此合并冲突中丢失的重要工作。
To solve this you need to:
要解决此问题,您需要:
Solve your merge: fix every merge issue
Make a
git pull
to download the newer code fromorigin
to your local repository.
解决您的合并:修复每个合并问题
使 a
git pull
将较新的代码从origin
本地存储库下载。
To finish the merge
you have to execute git commit
. This just lets git know that you have fixed every conflict.
要完成merge
你必须执行git commit
。这只是让 git 知道您已经修复了所有冲突。
Now, to ignore the files you need to put their names in the .gitignore
. If you put them there now then you'll notice that they are not being ignored. This is because Git is already tracking the files and the .gitignore
only ignores files that are not already being tracked. To fix this you can do:
现在,要忽略您需要将其名称放在.gitignore
. 如果您现在将它们放在那里,那么您会注意到它们并没有被忽略。这是因为 Git 已经在跟踪文件,并且.gitignore
唯一会忽略尚未跟踪的文件。要解决此问题,您可以执行以下操作:
git rm --cached .
git add .
The git rm --cached .
removes everything from tracking and git add .
adds everything again EXCEPT the things that are specified in you .gitignore
.
在git rm --cached .
从跟踪中删除一切,git add .
增加了再次的一切,除了在指定的东西.gitignore
。
NOTE:
You do not need to remove everything from tracking, if you want you can manually specify which files to remove from tracking by changing the .
with the name of the file you want to change. If you do this then it's not necessary to add everything again.
NOTE:
您不需要从跟踪中删除所有内容,如果您愿意,可以通过更改.
要更改的文件的名称来手动指定要从跟踪中删除的文件。如果您这样做,则无需再次添加所有内容。