Skip to content

Instantly share code, notes, and snippets.

@afa
Created August 2, 2011 09:26
Show Gist options
  • Save afa/1119884 to your computer and use it in GitHub Desktop.
Save afa/1119884 to your computer and use it in GitHub Desktop.
git workflow usage from sandofsky@t article
#Maybe my feature branch existed for a very long time, and I had to merge several branches into my feature branch to keep it up to date while I work. History is convoluted. It’s easiest to grab the raw diff create a clean branch.
git checkout master
git checkout -b cleaned_up_branch
git merge --squash private_feature_branch
git reset
#I now have a working directory full of my changes and none of the baggage from the previous branch. Now I manually add and commit my changes.
#cleaning history on long living branch
git rebase --interactive master
#in editor look:
pick ccd6e62 Work on back button
pick 1c83feb Bug fixes
pick f9d0c33 Start work on toolbar
#change must-be-squashed commits action to squash
pick ccd6e62 Work on back button
squash 1c83feb Bug fixes
pick f9d0c33 Start work on toolbar
#after save - message for joined commit will be asked
git checkout -b private_feature_branch
touch file1.txt
git add file1.txt
git commit -am "WIP"
#When I’m done, instead of a vanilla git merge, I’ll run:
git checkout master
git merge --squash private_feature_branch
git commit -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment