# git diffall, open all diff files immediatly (eg tabbed window in BC)

5 messages from 2009-08-21 to 2009-08-22. Participants: Seba Illingworth, David Aguilar.
Thread: https://gitlist.dev/t/20679

## Seba Illingworth, 2009-08-21 03:47

Subject: git diffall, open all diff files immediatly (eg tabbed window in BC)
Message-ID: <loom.20090821T053954-649@post.gmane.org>
URL: https://gitlist.dev/e/loom.20090821T053954-649%40post.gmane.org

```
I came up with the following 'git-diffall' script to open all diff files
immediately, rather than default behavior of opening them one at a 
time in serial.

    for name in $(git diff --name-only $1); do git difftool $1 $name & done

I blogged the details at 
http://blog.codefarm.co.nz/2009/08/git-diff-and-difftool-open-all-files.html

```

## David Aguilar, 2009-08-21 05:40

Subject: Re: git diffall, open all diff files immediatly (eg tabbed window in BC)
Message-ID: <20090821054044.GB32879@gmail.com>
URL: https://gitlist.dev/e/20090821054044.GB32879%40gmail.com
In-Reply-To: <loom.20090821T053954-649@post.gmane.org>

```
Hi,

On Fri, Aug 21, 2009 at 03:47:07AM +0000, Seba Illingworth wrote:
> I came up with the following 'git-diffall' script to open all diff files
> immediately, rather than default behavior of opening them one at a 
> time in serial.
> 
>     for name in $(git diff --name-only $1); do git difftool $1 $name & done
> 
> I blogged the details at 
> http://blog.codefarm.co.nz/2009/08/git-diff-and-difftool-open-all-files.html

You must have difftool.prompt (or mergetool.prompt) set to
false, otherwise git would be prompting you during the loop.

To make it work irrespective of the configuration, pass
--no-prompt or -y to difftool.


Also maybe something like:

for name in "$(git diff --name-only "$@")"; do
	git difftool "$@" "$name" &
done

The quotes should make it work paths that have spaces.
The "$@" should let you pass arbitrary parameters to difftool.

Have fun,

-- 
		David

```

## Seba Illingworth, 2009-08-21 05:54

Subject: Re: git diffall, open all diff files immediatly (eg tabbed window in BC)
Message-ID: <loom.20090821T074953-77@post.gmane.org>
URL: https://gitlist.dev/e/loom.20090821T074953-77%40post.gmane.org
In-Reply-To: <20090821054044.GB32879@gmail.com>

```
David Aguilar <davvid <at> gmail.com> writes:
> To make it work irrespective of the configuration...

Hi David, great to get your comments, thanks for the pointers!

```

## David Aguilar, 2009-08-21 23:45

Subject: Re: git diffall, open all diff files immediatly (eg tabbed window?in BC)
Message-ID: <20090821234512.GA58248@gmail.com>
URL: https://gitlist.dev/e/20090821234512.GA58248%40gmail.com
In-Reply-To: <loom.20090821T074953-77@post.gmane.org>

```
On Fri, Aug 21, 2009 at 05:54:48AM +0000, Seba Illingworth wrote:
> David Aguilar <davvid <at> gmail.com> writes:
> > To make it work irrespective of the configuration...
> 
> Hi David, great to get your comments, thanks for the pointers!

One last note (I promise ;)):

I would recommend against saying 'git difftool head' on your
blog beause that only works on OSX with its case-preserving yet
case-insensitive filesystem.  It might be worth mentioning that.

If you try 'git diff head' on a different filesystem (for
example, if you tried it on Linux) you'll find that it doesn't
work because the file is .git/HEAD; .git/head doesn't exist.

On OSX the filesystem tells git that .git/head exists even
though it's actually finding .git/HEAD.

-- 
		David

```

## Seba Illingworth, 2009-08-22 02:10

Subject: Re: git diffall, open all diff files immediatly (eg tabbed window?in BC)
Message-ID: <loom.20090822T035703-224@post.gmane.org>
URL: https://gitlist.dev/e/loom.20090822T035703-224%40post.gmane.org
In-Reply-To: <20090821234512.GA58248@gmail.com>

```
David Aguilar <davvid <at> gmail.com> writes:
> I would recommend against saying 'git difftool head' on your
> blog beause that only works on OSX with its case-preserving yet
> case-insensitive filesystem....

Thanks David, understood and updated to 'HEAD'. 'head' had worked for me with my 
sloppy Windows ways ;)

I struggled with your previous suggestion for handling paths with spaces; 
I couldn't get the for-loop to split the input into individual filenames
on the line-break separator (after outer quotes expanded the result?).

But rewriting it this way seems to work well and handles spaces (Windows):

    git diff --name-only "$@" | while read filename; do
        git difftool "$@" --no-prompt "$filename" &
    done

Hope you can comment on this variation? 
And thanks for all the tips! Seba

```
