0

Can you completely remove / revert a local commit and all changes without cluttering history?

I would like to incorporate into my workflow something like this:

When starting development, create development commit where I outcomment parts of the code / change environment variables. Then do the real work. Then revert the commit without it showing in history that I did so. The commit history could look something like this:

Realworkcommit2
Realworkcommit1
Developmentcommit1
...

When I am done working, I could revert Developmentcommit1, but that would result in it showing in history:

Reverted Developmentcommit1
Realworkcommit2
Realworkcommit1
Developmentcommit1
...

I would like to remove all traces of Developmentcommit1 having existed, so history looks like this instead, without the development changes showing in any of the commits:

Realworkcommit2
Realworkcommit1
...

Is this possible?

MyrionSC2
  • 1,248
  • 1
  • 14
  • 24
  • @matt Yep, if I remove the commit line with rebase -i it does what I want. I somehow thought that rebase would just add the commit changes to the the next commit, but it deletes them like I want. Thanks for helping out! – MyrionSC2 Mar 18 '20 at 11:11
  • If the problem is solved as a duplicate please delete the question. – matt Mar 18 '20 at 11:16

0 Answers0