Skip to content

Instantly share code, notes, and snippets.

@d-kang
Last active January 19, 2020 04:48
Show Gist options
  • Save d-kang/aa1ce78f2ada18597a63201c5ccb2578 to your computer and use it in GitHub Desktop.
Save d-kang/aa1ce78f2ada18597a63201c5ccb2578 to your computer and use it in GitHub Desktop.

GIT WORKFLOW ONE: When you are ready to push your commits

  1. Make sure all changed files are committed on feature-branch
  2. Rebase on your feature-branch => git pull --rebase upstream master
  3. Switch to your master branch => git checkout master
  4. Rebase on your master => git pull --rebase upstream master
  5. If there are changes then push changes to master => git push origin master
  6. Go back to feature-branch => git checkout feature-branch
  7. Push changes from feature-branch to github => git push origin feature-branch
  8. Submit pull-request on github
To update your origin master on github after your pr was accepted:
  1. After pull-request is accepted, delete feature-branch from Github to clean up github history
  2. On command-line switch back to master branch => git checkout master
  3. Rebase from master branch => git pull --rebase upstream master
  4. Push changes to your master => git push origin master
  5. Delete feature-branch => git branch -d feature-branch
  6. Create new branch => git checkout -b new-feature

GIT WORKFLOW TWO: If a somones PR has been merged on github and you want to rebase:

  1. You would currently be working on your feature-branch. Do a git branch to check
  2. Do a git status and commit any of your unstaged changes
  3. Rebase from feature-branch => git pull --rebase upstream master
  4. Switch to master branch and rebase => git pull --rebase upstream master
  5. Push updated changes up to github origin-master => git push origin master
  6. Move Back to feature-branch => git checkout feature-branch
  7. That’s it!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment