Skip to content

Instantly share code, notes, and snippets.

@cfarm
Last active August 29, 2015 14:03
Show Gist options
  • Save cfarm/80c953351da16604792c to your computer and use it in GitHub Desktop.
Save cfarm/80c953351da16604792c to your computer and use it in GitHub Desktop.
Github Flow

Workflow for Git and Github

  1. Create a new branch from master:

  2. git checkout master or git status to confirm you're working on master

  3. git branch my-new-branch

  4. Check out the new branch!!!

git checkout my-new-branch

  1. Make commits on this branch

  2. git add filename

  3. git commit -m "i edited a file"

  4. Push commits to remote repository (Github):

git push origin my-new-branch

This will create the branch on Github.

  1. When you're ready for the branch to be reviewed, it's PULL REQUEST TIME. Go to the repository and click the BIG GREEN BUTTON. You can see the site build by clicking the Deployment "Details" link on the bottom of the PR page.

  2. IF you can't merge through Github then you need to do it manually. Commands:

  3. git checkout master

  4. Then make sure you're up to date with git pull

  5. git merge my-new-branch

  6. git push origin master

  7. Once your Pull Request is approved and merged to master, you'll need to take an additional step to deploy it to the Client site by merging it to the production branch.

  8. git checkout production

  9. git merge master

TL;DR

  1. git checkout master
  2. git branch my-new-branch
  3. git checkout my-new-branch
  4. git add filename
  5. git commit -m "i edited a file"
  6. git push origin my-new-branch

BONUS: TAGS

You can create tags in Git and push them to Github to make specific 'releases' for a delivery. This freezes the codebase at that point in time at a url using that tagname.

  1. Create a tag called batch1-templates

git tag batch1-templates

  1. Push to Github!

git push --tags

  1. Check the Github 'Releases' tab for your repo to see all tags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment