Skip to content

Instantly share code, notes, and snippets.

@edds
Last active December 20, 2015 11:00
Show Gist options
  • Save edds/6120363 to your computer and use it in GitHub Desktop.
Save edds/6120363 to your computer and use it in GitHub Desktop.
Basic git workflow

A basic workflow to create a new branch, do work on it:

$ git pull

$ git checkout -b <branchname>

... code edits ...

$ git [add|rm] <files>

$ git commit -m '<commit message>'

To get the latest changes from origin into your branch:

$ git fetch

$ git rebase origin/master

To push your local branch to origin:

$ git push origin <branchname>

To merge the branch into master:

$ git checkout <branchname>

$ git pull

$ git checkout master

$ git pull

$ git merge <branchname>

$ git push

To get bash completion of branch names install git-completion (instructions at the top):

If you would like automatic rebasing everywhere run:

$ git config branch.autosetuprebase always
$ git config branch.master.rebase true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment