Skip to content

Instantly share code, notes, and snippets.

@connorrose
Last active August 11, 2020 22:20
Show Gist options
  • Save connorrose/8c91157894b0fe21bfc12135d82f7622 to your computer and use it in GitHub Desktop.
Save connorrose/8c91157894b0fe21bfc12135d82f7622 to your computer and use it in GitHub Desktop.
Github Workflow for Production Team

Initializing the project

  1. Create a personal fork of organization repository.
  2. Clone fork to your local machine.
  3. In the local clone of your personal fork: git remote add upstream https://github.com/oslabs-beta/Catalyst.git

When starting a new feature (locally)

  1. git checkout master -> Make sure you're starting at your local master branch
  2. git pull upstream master -> Pull in any merged changes from organization master
  3. git push origin master -> Update your remote fork with the new master
  4. git checkout -b <feature-name> -> Create a new feature branch and switch into it
  5. Work on your feature, committing to the feature branch only. Never work directly on master.
    Your local master should always be an exact copy of the organization master.

When you're ready to pull request

  1. git checkout master -> Start on your local master branch
  2. git pull upstream master -> Get any new changes that have been merged since you started your feature
  3. git push origin master -> Update remote fork master
  4. git checkout <feature-name> -> Switch to the feature branch you want to PR
  5. git merge master -> Merge the up-to-date master branch into your feature branch
  6. Resolve any merge conflicts on the feature branch & commit resolved changes if needed.
  7. git push origin <feature-name> -> Push the new feature, with merge conflicts resolved, to your remote fork
  8. On Github: Create a Pull Request from <your-name>/<feature-name> to <organization>/staging

After your PR is merged into master

  1. On your local copy: git checkout master
  2. git pull upstream master
  3. git push origin master

If you are continuing work on the same feature:

  1. git checkout <feature-name> -> Switch to the feature branch
  2. git merge master -> Should fast-forward your feature branch to be even with current organization master

If you ever get lost & need a visual of where each branch is currently pointing:

git log --graph --all --decorate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment