Git Recipes


Create a new branch off of the master branch to hold the new work that you are about to do

git checkout -b <new-branch-name> master  


If you are working on a feature branch (or any branch for that matter) and you want to pull in the changes that have been made to another branch (master for example)

git checkout <feature-branch>  
git merge <from branch>  


Change the location of an existing remote (in case of rename or relocation)

git remote  set-url origin <new url>  


If you need to temporarily set aside your code changes to work on another branch you can stash those changes

git stash  

When you want to re-apply your stashed changes to the current branch

git stash pop  

When you want to see what changes you’ve stashed away

git stash list  

Wes Shaddix

Read more posts by this author.