I use Atlassian SourceTree to work with git repository.
I committed and pushed big commit where desired and undesired changes were mixed. I rolled it back by committing and pushing Reverse Commit.
Now I want to extract desired changes from that big commit and commit them as smaller commit or may be even sequence of smaller commits.
Which SourceTree or git feature is best for this ? I guess it would be one of these: Cherry-pick, Patch, Merge or Reverse Commit of Reverse Commit with one of these 3 features.
I looked at Break a previous commit into multiple commits and Git Cherry-pick vs Merge Workflow, they are close, but don't directly answer my question.
First
git cherry-pick -n
your original commit using-n
for no commit. This will get you all the changes in your working directory but nothing added to the index nor committed.Then either
git add
each file that you intend to commit, optionallygit add -i
orgit add -p
to select files/patches to add.Commit whatever you have choose to commit in one commit, and then repeat until all changes are in the desired commits.