git rebase - Introduce local changes in git to specific comment in the past -


suppose have 2 commits on top master branch , uncommited local changes.
master -> commit 1 -> commit 2 -> (uncommited changes)
in commit 1 changed file a, in commit 2 changed file b. uncomitted changes contain both file , b modifications.
want take uncommited changes file , edit commit 1 contain these changes. same commit 2 , file b. have not pushed yet.
tried use git rebase -i git stash no success

here's how it:

$ git add -p 

[interactively add changes]

$ git commit -m $ git add -p 

[interactively add b changes]

$ git commit -m b 

now have 4 commits, each changing 1 file @ time. do

$ git rebase -i master 

and reorder commits commit 1, a, commit 2, b , mark , b fixup. save , quit , should rebase cleanly giving want.


Popular posts from this blog