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.
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
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 at
yourbranchbackwards 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.
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.
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.