0

If I have one change:
git both changed and added lines highlighted as a single change in IDEA
Force git to treat "a change" and "an addition" separately?: git changed and added lines highlighted separately in IDEA

Rules
  • 103
  • 1
  • 12

1 Answers1

1

First, commit the change in full (all changes at the same time, the way you want it to look like after the two revisions) and place a temporary branch there... like 'blah' git branch blah (no need to check it out).

Then set the file the way you want it on the first revision and amend the revision (git commit --amend -m "first change, blah blah").

Checkout blah (git checkout blah) and set the branch pointer on the other branch you were working on originally (git reset --soft the-other-branch, that won't touch the other branch, no worries). At this point the changes for the second revision are on the index.

Commit (git commit -m "second change for the file, blah blah"). Now blah has the changes one after the other the way you wanted originally. If you like the result of the history of the branch, force the other branch to where blah is and remove branch: (git branch -f the-other-branch; git checkout the-other-branch; git branch -d blah).

eftshift0
  • 26,375
  • 3
  • 36
  • 60