git - 我不知道如何解决的奇怪分支合并错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14744993/
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
git - strange branch merge error that I am not sure how to solve
提问by Genadinik
When I git status, I get this error message:
当我 git status 时,我收到此错误消息:
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 1 and 2 different commits each, respectively.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
nothing added to commit but untracked files present (use "git add" to track)
So I can't pull or push. When I pull I get this:
所以我不能拉也不能推。当我拉我得到这个:
macoss-MacBook-Pro-10:Marketing owner12$ git pull origin master
Password for 'https://[email protected]':
From https://bitbucket.org/genadinik/marketing
* branch master -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
.DS_Store
Please move or remove them before you can merge.
Aborting
What can I do to resolve this? Thanks!
我能做些什么来解决这个问题?谢谢!
回答by warrenm
rm .DS_Store
git add -A
git commit -m "Added .gitignore file"
You'll also want to expressly add .DS_Store
to your .gitignore
so that when .DS_Store
is inevitably created in the future, it won't get in the way of your commits.
您还需要明确添加.DS_Store
到您的内容中,.gitignore
以便.DS_Store
将来不可避免地创建时,它不会妨碍您的提交。
回答by xvorsx
You probably don't care about .DS_Store. So, try to move it to .DS_Store.bak and pull again
您可能不关心 .DS_Store。因此,尝试将其移动到 .DS_Store.bak 并再次拉
回答by Dnyan Waychal
I think you need to first add the files with add .
then pull
then commit
and push
我想你需要先用添加的文件add .
,然后pull
再commit
和 push