A place for spare thoughts

17/06/2011

GitExtensions command line usability

Filed under: git — Ivan Danilov @ 17:07

I prefer to use git bash command line for manipulations with repository (push, pull, checkout, rebase, merge, git-tfs’ commands etc) and GUI for things like staging, merging files, viewing history, blaming etc. Thus I always have bash console opened at my repository root.
Unfortunately when I tried to run commit process via GUI I have this:

$ gitex
sh.exe": gitex: command not found</blockquote>

From cmd.exe’s console everything is just working. cmd.exe in fact is calling gitex.cmd from GitExtensions’ root folder which is just settings paths and starts GitExtensions.exe with given command line arguments.

Bash just can’t run *.cmd file. Well, it is not a big problem. I just have to write my own script to do the same. It is strange that GitExtensions didn’t include this thing from the start. Or maybe I missed something?

Anyway, you need just file “gitex” (without extension) with this lines:

#!/bin/sh

GitExtensions.exe "$@" &

$@ means to pass to GitExtensions.exe all command line arguments that were passed to the script and & means we want it to be started separately, i.e. mingw console should return immediately and do not wait until GitExtensions.exe process finished.

P.S. As a Windows user I also fallen into a trap of missing “#!/bin/sh” at the beginning and got same message. And ‘chmod a+x gitex’ to make it executable didn’t help either. It seems mingw determines executability of a file just by that header.

Advertisements

2 Comments »

  1. You should replace $@ with “$@” – otherwise, passing parameters with spaces (such as paths or filenames) to GitExtensions.exe will fail.

    Comment by James — 10/07/2011 @ 23:17

  2. Good point, thanks. I usually just start something like ‘gitex commit’ or ‘gitex browse’ so didn’t mention it.

    Comment by sparethought — 10/07/2011 @ 23:30


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: