Skip to content

Instantly share code, notes, and snippets.

@jmeridth
Forked from jmarnold/gm.sh
Created October 12, 2011 12:56
Show Gist options
  • Select an option

  • Save jmeridth/1281163 to your computer and use it in GitHub Desktop.

Select an option

Save jmeridth/1281163 to your computer and use it in GitHub Desktop.

Revisions

  1. jmeridth revised this gist Oct 12, 2011. 1 changed file with 10 additions and 4 deletions.
    14 changes: 10 additions & 4 deletions gm.sh
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,15 @@
    # the good-morning command (where upstream is your target remote -- or could be origin)
    function gm {
    function rebasei {
    branch_name="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /')"
    echo "Currently on $branch_name"
    git checkout master
    git pull upstream master
    git pull origin master
    git checkout $branch_name
    git rebase master
    git rebase -i master
    }

    function finishrebase {
    branch_name="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /')"
    git checkout master
    git merge $branch_name
    git push origin master
    }
  2. @jmarnold jmarnold created this gist Oct 12, 2011.
    9 changes: 9 additions & 0 deletions gm.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    # the good-morning command (where upstream is your target remote -- or could be origin)
    function gm {
    branch_name="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /')"
    echo "Currently on $branch_name"
    git checkout master
    git pull upstream master
    git checkout $branch_name
    git rebase master
    }