gitflow icon indicating copy to clipboard operation
gitflow copied to clipboard

git flow refactor

Open lifeiscontent opened this issue 11 years ago • 1 comments

Each change in git should be easy to introduce. If it’s not, you should refactor. When you are making your changes, you will be in a feature branch. Try to make your change without refactoring. If your meet resistance, make a “work in progress” commit, check out your base branch, and create a new refactoring branch:

git commit -m 'wip: new feature'
git checkout $base-branch
git checkout -b refactoring-for-new-feature

Refactor until you fix the resistance you met on your feature branch. Then, rebase your feature branch on top of your refactoring branch:

git commit -m 'refactor for new feature'
git rebase -i new-feature
git checkout new-feature
git merge refactoring-for-new-feature --ff-only

this flow works well for me, and I think it'd be better if I could just do the following with git flow.

git commit -m 'wip: new feature'
git flow refactor start # switch to refactor branch
git commit -m 'refactor for new feature'
git flow refactor finish # switch to feature branch

What are your thoughts?

lifeiscontent avatar Jun 19 '13 18:06 lifeiscontent

@nvie

lifeiscontent avatar Jan 03 '20 19:01 lifeiscontent