Rewrite history
Future years will never know the seething hell and the black infernal background of [implementing this feature]; and it is best they should not -- the real war will never get in the books.
Walt Whitman was speaking about the American Civil War, not your feature branch, but either way it's not clear if this is good advice. When something goes wrong, in culture or code, we will look to the past to try to understand how we got here. Assuming you don't intend to deceive future archaeologists, then it is important for your history to be accurate and detailed. But there may be some value in some amount of condensing and summarizing your changes so that future and present collaborators may understand your intent more clearly.
We've touched on some of these techniques in passing before, but this is our chance to provide a full overview and introduce some new techniques.
Squash
The simplest history-simplification is to simply squash two or more commits together. Ctrl-select the commits you want to squash, right-click, and select Squash
.
Rewrite
If you drag the working copy branch backwards to a point on its history, you are given the option to Rewrite branch from here
. When you do this, DiffPlug will:
- create a new branch called
yourbranch-pre
, which will point atyourbranch
before drag - add
yourbranch-pre
to tips - move
yourbranch
backwards to wherever you dragged it
This means that you have moved your project back in time, but you can easily see all the work you have done since then.
You now have two options, a summary merge or a full rewrite.
Summary merge
The summary merge keeps every single commit of your brainstorming, and supplements it with a summary of the final result. We discussed this technique in more detail in the merge section.
Full rewrite
You can also pick and choose which commits to include or exclude, and in which order.
It is also possible to split a large commit into multiple smaller ones, or vice-versa.
Durability is social
Ancient cathedrals don't stand because stone is immortal - they stand because people understand their history and choose to maintain them. Undiscovered temples rotting in the wilderness do not rot because their stone is weak, they rot because humankind has forgotten their story.
It may be that you are the only human that will look at your work, but even a week from now you will forget what you were thinking today. Each of us is a society unto ourselves, and when we are tired, we are attacked by ideas we conquered long ago.
Your work has always told a story, but it was sparse and accidental. You now have the tools to do better.