git gui: add pull and stash commands

It was not easy and took some time but I learned to like git gui tool. It has raw interface and manners but it can be used for most of basic git operations. It is also available everywhere and is deterministic and reliable.

But time to time I miss more advanced commands. Fortunatelly there is possibility to add new commands via gitconfig file. Typically located at ~/.gitconfig path. Then these commands appears in Tools main menu.

First thing I miss is stash functionality. It can be added by following entries added to mentioned file:

[guitool "Stash/show"]
    cmd = git stash show -p

[guitool "Stash/list"]
    cmd = git stash list

[guitool "Stash/pop"]
    cmd = git stash pop

[guitool "Stash/drop"]
    cmd = git stash drop
    confirm = yes

[guitool "Stash"]
    cmd = git stash

It is also annoying to do fetch+merge operations instead of pull. Unfortunatelly pull needs name of remote and branch as parameters, so you need a bit of scripting:

[guitool "Pull"]
    cmd = git pull $(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD) | tr / " ")

It automatically select remote branch of tracking branch. Maybe it won’t work correctly in setups with more remote branches but for single remote it works fine.


Tags:  GIT 
Last blog articles:
Disable startup logs of Tomcat in Eclipse
Obchodování pro programátory
Mým fuckupům
Ubuntu: Login loop
Leaving LinkedIn

Java Ubuntu česky Gradle personal Software-architecture Eclipse DIY children React DisplayLink AI Spring JavaScript AspectJ startup podnikání neuron Tomcat SSH LXC JavaFX Immutables Gnome3 GIT FatJar Edison technologies science procrastination pokusy linux lambda kvas ellipsis destilace chemie alkohol VisualVM Upstart Selenium REST PrimeFaces Log4j Jooq Jackson JSF Debug DI CSS

Last tweets: