git的 - 这我不知道如何解决奇怪的分支合并错误(git - strange branch mer

2019-08-16 19:21发布

当我的Git的状态,我得到这个错误信息:

# 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)

所以,我不能拉或推。 当我拉我得到这样的:

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

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

Answer 1:

rm .DS_Store
git add -A
git commit -m "Added .gitignore file"

你还需要明确添加.DS_Store.gitignore这样当.DS_Store在未来不可避免地产生,也不会在你提交的方式获得。



Answer 2:

你可能不关心.DS_Store。 因此,尝试将其移动到.DS_Store.bak,再次拉



Answer 3:

我想你需要先用添加文件add . 然后pull然后commitpush



文章来源: git - strange branch merge error that I am not sure how to solve
标签: git git-merge