Skip to content

Instantly share code, notes, and snippets.

@depressiveRobot
Last active June 6, 2020 13:21
Show Gist options
  • Save depressiveRobot/626e7066e77da1659c97 to your computer and use it in GitHub Desktop.
Save depressiveRobot/626e7066e77da1659c97 to your computer and use it in GitHub Desktop.

Revisions

  1. depressiveRobot revised this gist Apr 7, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions git-function.sh
    Original file line number Diff line number Diff line change
    @@ -20,5 +20,8 @@ function git() {
    fi
    git-email-prompt.sh
    fi
    else
    # return the exit code of the failed git command call
    return $?
    fi
    }
  2. depressiveRobot revised this gist Jan 29, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-function.sh
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ function git() {
    # no directory given, parse it from repository url
    cd $(echo $lastArgument | awk -F/ '{ print $NF }' | rev | sed 's/tig.//' | rev)
    fi
    _gitIdentity
    git-email-prompt.sh
    fi
    fi
    }
  3. depressiveRobot revised this gist Jan 23, 2015. 1 changed file with 11 additions and 8 deletions.
    19 changes: 11 additions & 8 deletions git-function.sh
    Original file line number Diff line number Diff line change
    @@ -6,16 +6,19 @@ function git() {

    /usr/local/bin/git $@

    if [[ "$1" = "init" || "$1" = "clone" ]]
    if [[ $? -eq 0 ]] # only show prompt if git command was successful
    then
    if [[ -d "$lastArgument" ]]
    if [[ "$1" = "init" || "$1" = "clone" ]]
    then
    # it was the directory argument, cd it
    cd $lastArgument
    else
    # no directory given, parse it from repository url
    cd $(echo $lastArgument | awk -F/ '{ print $NF }' | rev | sed 's/tig.//' | rev)
    if [[ -d "$lastArgument" ]]
    then
    # it was the directory argument, cd it
    cd $lastArgument
    else
    # no directory given, parse it from repository url
    cd $(echo $lastArgument | awk -F/ '{ print $NF }' | rev | sed 's/tig.//' | rev)
    fi
    _gitIdentity
    fi
    _gitIdentity
    fi
    }
  4. depressiveRobot revised this gist Jan 22, 2015. 1 changed file with 7 additions and 11 deletions.
    18 changes: 7 additions & 11 deletions git-function.sh
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,13 @@
    function git() {

    if [[ "$1" = "init" ]] # ask for identity after init
    then
    /usr/local/bin/git $@
    _gitIdentity
    elif [[ "$1" = "clone" ]] # ask for idenity after clone
    for i do
    lastArgument=$i # last argument can be the directory or the repository url
    done

    /usr/local/bin/git $@

    if [[ "$1" = "init" || "$1" = "clone" ]]
    then
    for i do
    lastArgument=$i # last argument can be the directory or the repository url
    done
    /usr/local/bin/git $@
    if [[ -d "$lastArgument" ]]
    then
    # it was the directory argument, cd it
    @@ -19,7 +17,5 @@ function git() {
    cd $(echo $lastArgument | awk -F/ '{ print $NF }' | rev | sed 's/tig.//' | rev)
    fi
    _gitIdentity
    else
    /usr/local/bin/git $@
    fi
    }
  5. depressiveRobot revised this gist Jan 22, 2015. 1 changed file with 12 additions and 7 deletions.
    19 changes: 12 additions & 7 deletions git-function.sh
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,24 @@
    function git() {

    if [[ "$1" = "init" ]] # ask for email after init
    if [[ "$1" = "init" ]] # ask for identity after init
    then
    /usr/local/bin/git $@
    git-email-prompt.sh
    elif [[ "$1" = "clone" ]] # ask for email after clone
    _gitIdentity
    elif [[ "$1" = "clone" ]] # ask for idenity after clone
    then
    for i do
    lastArgument=$i # last argument can be the directory or the repository url
    done
    /usr/local/bin/git $@
    if [[ "$3" = "" ]] # no directory given, extract from repo name
    if [[ -d "$lastArgument" ]]
    then
    cd $(echo $2 | awk -F/ '{ print $NF }' | rev | sed 's/tig.//' | rev)
    # it was the directory argument, cd it
    cd $lastArgument
    else
    cd $3
    # no directory given, parse it from repository url
    cd $(echo $lastArgument | awk -F/ '{ print $NF }' | rev | sed 's/tig.//' | rev)
    fi
    git-email-prompt.sh
    _gitIdentity
    else
    /usr/local/bin/git $@
    fi
  6. depressiveRobot renamed this gist Jan 5, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. depressiveRobot renamed this gist Jan 5, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. depressiveRobot renamed this gist Jan 5, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  9. depressiveRobot created this gist Jan 5, 2015.
    20 changes: 20 additions & 0 deletions git-function
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    function git() {

    if [[ "$1" = "init" ]] # ask for email after init
    then
    /usr/local/bin/git $@
    git-email-prompt.sh
    elif [[ "$1" = "clone" ]] # ask for email after clone
    then
    /usr/local/bin/git $@
    if [[ "$3" = "" ]] # no directory given, extract from repo name
    then
    cd $(echo $2 | awk -F/ '{ print $NF }' | rev | sed 's/tig.//' | rev)
    else
    cd $3
    fi
    git-email-prompt.sh
    else
    /usr/local/bin/git $@
    fi
    }