Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created October 12, 2011 04:35
Show Gist options
  • Save jmarnold/1280290 to your computer and use it in GitHub Desktop.
Save jmarnold/1280290 to your computer and use it in GitHub Desktop.
The Good Morning Command
# 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
}
@jmeridth
Copy link

jmeridth commented Dec 6, 2011

with msysgit installed

  1. vim ~/.bashrc
  2. :set paste (notice the prefixing colon)
  3. press 'i' to go into insert mode
  4. paste function above
  5. press esc
  6. :wq (notice the prefixing colon)
  7. source ~/.bashrc
  8. inside git bash just type 'gm'

@phatboyg
Copy link

phatboyg commented Dec 6, 2011

Got it, thanks!

@jmarnold
Copy link
Author

jmarnold commented Dec 7, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment