this seems like it should be a simple question to find the answer for, but I've been searching and pulling my hair out all morning and I just cant find an answer that satisfies me. The closest thing I've been able to find is this question, Git merge squash repeatedly, but that question is from 11 years ago, so hopefully the consensus of "you simply can't do that unless you create temporary branches" has changed.
I'm working on a long-term project where I'm basically the only contributor. Ideally, I want there to be one long-term ongoing development
branch that I can continue tinkering and working on bit by bit, and periodically make a squash-merge to the master
branch whenever I get to a stable, releasable state. I don't want to have the full commit history available/visible on master
, because I want to be able to easily walk backwards thru the history of stable official releases. But, I do want the full commit history to be available somewhere for if it ever becomes relevant.
The problem is, if I try to do this the way that intuitively feels like it should work, it just doesn't. The squash-merge-commit creates a commit on master
that doesn't match anything in development
, so the next time I try do do a squash-merge it will say there is a conflict and I need to merge from master
into development
... and as I repeat this process more and more, this problem keeps growing and I've got half a dozen commits bouncing back and forth between the two branches that don't actually change any files, but I just can't seem to get rid of.
The graphical picture I want to make looks something like this, if that makes any sense:
B-------------------G-----------J master
/ / /
a---b---c---d---e---f---g---h---i---j development
The solution I've been using up until now is annoyingly ugly: I create a new branch with the version number, such as development_601
, then I do a pull request from that branch to master when I'm stable again and squash-merge the commits, then I create another new branch development_602
from master
after the squash-merge. development_601
gets mothballed. This seems cluttered and annoying and just wrong, especially because of how Git seems to be hinting that I should delete my branch after merging the pull request, but like I said I want to have a record of my complete messy history somewhere, I just don't want it to be (easily) outwardly visible.
I've been using the Github Desktop app along with the Github website; I've been trying to avoid putting console commands into my workflow.
Is this such a strange behavior to want? I feel like "having one long-term development
branch with a master
/release
branch that periodically but incompletely mirrors it" is an extremely common system, but somehow I just can't find anywhere that explains how to make it happen.