Skip to content

Instantly share code, notes, and snippets.

@hansohn
Last active January 5, 2019 20:51
Show Gist options
  • Save hansohn/54510553ed6818834838951dbca129f9 to your computer and use it in GitHub Desktop.
Save hansohn/54510553ed6818834838951dbca129f9 to your computer and use it in GitHub Desktop.
git rebase and merge strategy

Team git contribution model

  • git checkout master
  • git pull --rebase origin master
  • git checkout -b some_feature_description
  • Work, review, thumbs up, prepare to put in master
    • git push -u origin some_feature_description
  • git checkout origin master
  • git pull --rebase origin master
  • git checkout some_feature_description
  • git rebase master
  • Resolve conflicts if necessary
    • git push -u --force origin some_feature_description
  • git checkout master
  • git merge --no-ff some_feature_description
  • git push origin master
  • Cleanup after yourself when you are ready
    • git branch -d some_feature_description
    • git push origin :some_feature_description

Community git contribution model

  • git remote add upstream https://github.com/whoever/whatever.git
  • git fetch upstream
  • git checkout master
  • git rebase upstream/master
  • git push -f origin master
  • git checkout -b some_feature_description
  • Work, review, thumbs up, prepare to put in master
    • git push -u origin some_feature_description
  • git fetch upstream
  • git checkout master
  • git rebase upstream/master
  • git checkout some_feature_description
  • git rebase master
  • Resolve conflicts if necessary
    • git push -u --force origin some_feature_description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment