问题
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!
回答1:
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.
回答2:
You probably don't care about .DS_Store. So, try to move it to .DS_Store.bak and pull again
回答3:
I think you need to first add the files with add .
then pull
then commit
and push
来源:https://stackoverflow.com/questions/14744993/git-strange-branch-merge-error-that-i-am-not-sure-how-to-solve