Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created October 12, 2011 04:35
Show Gist options
  • Select an option

  • Save jmarnold/1280290 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

Cloned it and already used it. Thanks.

@phatboyg

phatboyg commented Dec 6, 2011

Copy link
Copy Markdown

Call me a moron, but how do I use this on Windows? :)

@jmeridth

jmeridth commented Dec 6, 2011

Copy link
Copy Markdown

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

phatboyg commented Dec 6, 2011

Copy link
Copy Markdown

Got it, thanks!

@jmarnold

jmarnold commented Dec 7, 2011 via email

Copy link
Copy Markdown
Author

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