Git Tips via Ryan Florence

I had a dumb question I asked on the Utah JS Google Group here Ryan Florence answered with some super helpful git tips:

First, make your life easier and alias checkout to co:

git config –global alias.co checkout

Then simply:

git co my-topic

If the branch is new then

git co -b my-topic

If you accidentally committed it to the wrong branch (oh no!)

git reset –soft HEAD^
git co my-topic

First command removes the last commit but leaves the files in-tact (like you never committed)

Git stash is most useful when you need to pull from a remote (it creates a “temporary” commit).

git stash
git pull –rebase origin
git stash pop