git - 奇怪的分支合并错误,我不知道如何解决 [英] git - strange branch merge error that I am not sure how to solve

查看:458
本文介绍了git - 奇怪的分支合并错误,我不知道如何解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 #分支大师
#你的分支和'origin / master'分别为
#并且分别有1个和2个不同的提交。

#未追踪的文件:
#(使用git add< file> ...来包含将要提交的内容)

#。 gitignore
没有添加提交,但未跟踪的文件存在(使用git add跟踪)

所以我不能拉或推。当我拉我得到这个:

pre $ macoss-MacBook-Pro-10:市场主12 $ git pull origin master
'https://genadinik@bitbucket.org'的密码:
从https://bitbucket.org/genadinik/marketing
* branch master - > FETCH_HEAD
错误:以下未跟踪工作树文件将被合并覆盖:
.DS_Store
请在合并之前移动或移除它们。
正在取消

我能做些什么来解决这个问题?
Thanks!

解决方案

  rm .DS_Store 
git add - A
git commit -m添加.gitignore文件

您还需要向 .gitignore 添加 .DS_Store ,以便当 .DS_Store 在将来不可避免地会被创建,它不会妨碍您的提交。


When I git status, I get this error message:

# 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://genadinik@bitbucket.org': 
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!

解决方案

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_Storeis inevitably created in the future, it won't get in the way of your commits.

这篇关于git - 奇怪的分支合并错误,我不知道如何解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆