Xcode, git and .DS_Store

On trying to merge two git branches, I’ve often found Xcode 4 displays “Branches not found” in the Merge dialog, despite the Organiser clearly recognising multiple branches for the repo.

It seems the problem occurs because Xcode believes the working copy has uncommitted changes (even though the Commit dialog clearly shows there’s nothing to commit). The reason is that Xcode 4 doesn’t instruct git to ignore system invisible files, specifically .DS_Store (see rdar://8951416).

Turns out the workaround isn’t hard, just create a global excludes file:

git config --global core.excludesfile ~/.gitignore

… and ensure .DS_Store is ignored:

echo .DS_Store >> ~/.gitignore

Xcode will then allow you to merge branches or perform any other operation that was being prevented because it incorrectly thought there was something to commit.

猜你喜欢

转载自rbbtsn0w.iteye.com/blog/1736860