16

当我 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)

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

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

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

4

3 回答 3

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

您还需要明确添加.DS_Store到您的.gitignore,以便.DS_Store将来不可避免地创建时,它不会妨碍您的提交。

于 2013-02-07T06:32:15.930 回答
1

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

于 2013-02-07T06:33:53.820 回答
0

我认为您需要先添加文件 add .然后pull然后commitpush

于 2013-02-07T06:32:04.833 回答