Replace git pull with git up

As stated in the git-config documentation, it is not possible to alias an existing git command.

We can use a bash function that asks you to confirm that you want to actually use the git pull command, and also offers you the opportunity to use git up instead:

function git() {
    if [[ $@ == "pull" ]]; then
        read -p "Do you want to [p]ull, [u]p or [a]bort? " yn
        case $yn in
            [Pp]* ) command git pull;;
            [Uu]* ) command git up;;
            * ) echo "bye";;
        esac
    else
        command git "$@"
    fi
}

Example

$ git pull
 Do you want to [p]ull, [u]p or [a]bort? u
 Fetching origin
 master up to date
$ git pull
 Do you want to [p]ull, [u]p or [a]bort? p
 Already up-to-date.
$ git pull
 Do you want to [p]ull, [u]p or [a]bort? a
 bye

Tags:

Git

Git Pull