Quantcast
Channel: Bash alias/function to precede every "git diff" with "clear" - Super User
Viewing all articles
Browse latest Browse all 2

Bash alias/function to precede every "git diff" with "clear"

$
0
0

Every time I do git diff I'd like my bash to do clear & git diff instead.

I tried to tweak an answer at "Bash: Spaces in alias name" like this:

git() {
    if [[ $@ == "diff" ]]; then
        command clear && git diff
    else
        command git "$@"
    fi
}

But unfortunately, this does not work (the command line ends up in a sort of infinite loop switching between bash and git forever and I need [CTRL|CMD]+C to break from it).


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images