Skip to content

Instantly share code, notes, and snippets.

@zeke
Created November 9, 2011 20:44
Show Gist options
  • Save zeke/1352951 to your computer and use it in GitHub Desktop.
Save zeke/1352951 to your computer and use it in GitHub Desktop.
git_workflow.sh
# (Assuming master is your main branch)
# To create a local branch
git checkout -b experiment
# To push a local branch to remote
git push origin experiment
# To check out an *existing* remote branch
# (In earlier versions, you needed an explicit --track option, but now it's the default when branching off a remote branch)
git checkout -b test origin/test
# Make your changes and commit
git commit -a -m "DEV-1234 did some really crazy stuff"
# 1. Rewind your changes
# 2. Pull down the latest changes from master
# 3. Apply them to your branch
# 4. Reapply your changes
git pull --rebase origin master
# Go back to master and merge in your local branch
git checkout master
git merge experiment
# Delete the local branch
git branch -d experiment
# Delete the remote branch
git put origin --delete experiment
# or..
git put origin :experiment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment