Skip to content

Instantly share code, notes, and snippets.

@vidma
Created October 10, 2016 08:17
Show Gist options
  • Save vidma/39dbc3e8f5bd9c5c1c052039c7c9086e to your computer and use it in GitHub Desktop.
Save vidma/39dbc3e8f5bd9c5c1c052039c7c9086e to your computer and use it in GitHub Desktop.

and remember this is much better than git pull master on a feature branch:

# use git pull on in master branch! so it will never create nasty merge commits
git checkout master
git pull origin master

# development
git checkout -b your_feature_branch

# rebase your changes over changed master:
# first squash, modify, cleanup your changes if needed (less uneeded commits, less conflicts)
git rebase --interactive first-commit-id-you-dont-want-to-touch-anymore

# rebase over master, so your changes will look as if you started them right now
git rebase master 

git push your_stuff

# another good friend is cherry-pick
git checkout -b your_new_feature_branch
git cherry-pick one-commit-id-which-you-want-to-pick

see https://www.atlassian.com/git/tutorials/rewriting-history https://help.github.com/articles/about-git-rebase/

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