Skip to content

Instantly share code, notes, and snippets.

@xpepper
Last active May 2, 2020 15:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xpepper/f1562f136359bff3d253ccb1deeaacc9 to your computer and use it in GitHub Desktop.
Save xpepper/f1562f136359bff3d253ccb1deeaacc9 to your computer and use it in GitHub Desktop.
Keeping a branch up-to-date with master

Keeping a branch up-to-date with master and then merge back the branch to master

git checkout new-feature # Go to the feature branch named "new-feature"
git rebase master

# Now your feature have all the commits from master!
# this is because "git rebase master" reads like "git, please rebase my commits on top on the commits from master"

git checkout master # Go back to master
git merge --ff-only new-feature

(see https://shinglyu.com/web/2018/03/25/merge-pull-requests-without-merge-commits.html)

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