git

How can I make -p the default for git stash show?


When I show a git stash with git stash show, I get a diffstat. git stash show -p gives me the stash as a patch, which is much more useful for seeing what's in there.

I'm not really keen on having an alias like git config --global alias.sts 'stash show -p', as I never remember what aliases I have — I'd rather have git stash show default to displaying as a patch.

Is there a way to make -p the default, so just typing git stash show does the right thing?


Solution

  • @john-y, @ben-weller, @tay-ray-chuan

    There is now (or probably has been for a while) an option in your ~/.gitconfig to set this:

    [stash]
            showPatch = true
            showStat = false
    

    Read all about it at git stash docs near stash.showPatch.