Skip to content

Instantly share code, notes, and snippets.

@dpatlut
Created June 15, 2020 16:30
Show Gist options
  • Save dpatlut/d689859f41f8e5dc55ada34858d9383a to your computer and use it in GitHub Desktop.
Save dpatlut/d689859f41f8e5dc55ada34858d9383a to your computer and use it in GitHub Desktop.
Git Workflow

GitHub Workflow

Feature Branches

High level overview: pull latest master, make a branch, commit changes, push to GitHub, make a PR, get it approved, merge it to master. Rinse and repeat.

  1. Make issue corresponding to feature
  2. git checkout master
  3. git pull to get master up to date
  4. git checkout -b YOUR-NEW-BRANCH-NAME to switch to a new branch
  5. Make commits for a given feature.
  • Use semantic commit messages: type(scope): message e.g. feat(client): switch to React-Redux
  • Keep commits related to that feature branch. If you need to make other commits, go back to master, make a new branch, add those separate commits etc.
  1. When you are done, git push -u origin YOUR-NEW-BRANCH-NAME
  2. Navigate to GitHub
  3. Select "open pull request"
  4. Refer to any issues the PR will close, e.g. Closes #32, closes #46. You need to use "closes" for each issue separately.
  5. Request a review
  6. Address review comments by pushing more commits
  7. When all checks pass, merge to master
  8. On your local machine, git checkout master
  9. git pull
  10. Start the cycle again

Merge Conflicts

GitHub has an online merge conflict resolution tool, but you can and should learn how to fix merge conflicts locally too.

  1. On your local machine, git checkout master
  2. git pull
  3. git checkout YOUR-FEATURE-BRANCH
  4. git merge master
  5. git status
  6. Find all conflicts and fix them manually. Collaborate / communicate with teammates to decide how best to do so!
  7. git add -A
  8. git commit
  9. git push
  10. Check that the PR now has no conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment