netimen
netimen

Reputation: 4419

Git: fast diff viewing before commit

Before I commit I run git status and get output like this:

#   modified:   TemplateDemo/src/com/example/templatedemo/Item.java
#   modified:   TemplateLib/res/layout/layout_list.xml
#   modified:   TemplateLib/res/layout/list_header.xml
#   modified:   TemplateLib/res/values/strings.xml
#   modified:   TemplateLib/src/com/saturn/templatelibrary/ISwappableAdapter.java
#   modified:   TemplateLib/src/com/saturn/templatelibrary/ItemAnimator.java
#   modified:   TemplateLib/src/com/saturn/templatelibrary/SwappableAdapter.java
#   modified:   TemplateLib/src/com/saturn/templatelibrary/TemplateListActivity.java
#   modified:   TemplateLib/src/com/saturn/templatelibrary/TemplateListFragment.java

Now I want to view diff for each file. Now I do it like this: I manually select each filename from the command this output and run meld <filename> for each file in the list. Is there a faster way?

Upvotes: 1

Views: 168

Answers (4)

ks1322
ks1322

Reputation: 35716

I manually select each filename... Is there a faster way?

Yes. If you prefer meld for viewing diffs you can run meld . from the same directory where you run git status. Then you can select any filename in meld GUI to view diff or view diffs for all files at once with every diff in separate tab.

Upvotes: 0

michas
michas

Reputation: 26525

Just running git diff should do exactly what you want.

If you want a more graphical view use git difftool.

Upvotes: 1

crea1
crea1

Reputation: 12537

Git gui is my weapon of choice for this. You can easily scan through each file and see what's removed, and what is added.

Upvotes: 0

Matt Clark
Matt Clark

Reputation: 28589

There are many third party programs that make Git much simpler to use, and also show you diffs of each file before you stage them, and even allow you to stage chucks at a time.

SourceTree is my GoTo program for Git.

Upvotes: 0

Related Questions