Git is a weird branch merge error that I'm not sure how to solve

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) 

Therefore, I cannot 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 solve this problem? Thanks!

+6
source share
3 answers
 rm .DS_Store git add -A git commit -m "Added .gitignore file" 

You also want to explicitly add .DS_Store to your .gitignore , so that if you inevitably create .DS_Store in the future, this will not interfere with your commits.

+30
source

You probably are not interested in .DS_Store. So try moving it to .DS_Store.bak and pulling again

+1
source

It seems to me that you need to first add files using add . , then pull , then commit and push

0
source

All Articles