So what you have now is a chain of commits all on one branch:
--(1)--(2)--(3)--(4) master
There are many things you could do from here. Here's the approach I would take. Start by creating some branches to keep track of the work you already have:
git branch features/3_and_4
git branch features/1_and_2 commit_2
------------ features/1_and_2
|
--(1)--(2)--(3)--(4) master
features/3_and_4
Checkout those branches and verify they actually contain the history you want before you proceed, we're about to do something potentially destructive.
git checkout master
git reset --hard commit_2
Now we should have:
--(1)--(2) master
| features/1_and_2
|
--(3)--(4) features/3_and_4
Now you're in a good position to move forward. If features 1 and 2 are done you can merge their branch into master and continue development there (though I suggest you start a new branch off of master for each feature and merge it when the feature is finished.
Eventually you might return to features 3 and 4 after making some other changes. You'll then be looking at something like:
--(1)--(2)--(5)--(6) master
|
--(3)--(4) features/3_and_4
That is where you might want rebase
to bring your old features up to date:
git checkout features/3_and_4
git rebase master
--(1)--(2)--(5)--(6) master
|
--(3)--(4) features/3_and_4
All of the above assumes you are in a good position to rewrite history, no one else has seen these changes so it's fine to reorder them. If that's not the case you could still start with the same branches but you'll want to avoid reset
and possibly avoid rebase
as well depending on your team's workflow.