lehn0058 lehn0058 - 1 year ago 108
Git Question

How can I see what files Git is going to push to the server in Xcode?

I have Git setup on an Xcode project and I make many small local commits before I push them to the server. However, I am not able to tell easily what all of the file changes are if I would do a git push. I know that you can look in the organizer and see all of your individual commits, but I can't seem to find an aggregate view of these changes.

Essentially, if I commit changes locally to a file multiple times, I want to see the aggregate of those changes before I push the file to the server.

Does something like this exist in Xcode, or in some 3rd party tools for Xcode?

Answer Source

Command Line

git diff --name-only origin/master

Will list the files that you have changed but not pushed.

git diff origin/master directory_foo/file_bar.m

Will list the line by line diff of all the un-pushed changes to directory_foo/file_bar.m.

GUI Tool

If your looking for GUI Tools for a Git workflow, I use Xcode to commit locally and SourceTree to push and pull. Before Xcode and SourceTree I was a diehard command line SCM person. But I really like committing locally with Xcode, it streamlined a multi-step process of reviewing the change diffs and committing very nicely. The more I've used SourceTree the more I like it and the less I use the command line. I've always liked Atlassian's products and the $10 license for indies and small startups rocks. Now I just Love them to death for buying SourceTree and making free on the Mac App Store.

enter image description here

I think SourceTree does exactly what you want to do. On the tool bar the red 3 shows I have 3 commits to push. You just select master and origin/master to get an aggregate of what will be pushed. The bottom left pain shows the files changed and the right shows the aggregated diff for that file.

FYI: Two awesome presentations on Git (Absolutely Must Watch)

Git For Ages 4 And Up http://www.youtube.com/watch?v=1ffBJ4sVUb4

Advanced Git http://vimeo.com/49444883