I never thought about it and instantly wanted to reply “wait why can’t you do that‽” but now that I thought about it, what would you want the history to look like in that case?
A slightly weird rebase?
A single commit which seemingly copy pasted the entire other branch with no relation to it left behind?
Sometimes you really don’t want to look over the commit history of your colleagues. As long as it’s a small feature, a single commit is a pretty good option.
Yeah, I’m with you. I mean, git isn’t magic. You “can” squash anything, including a merge commit, by just being at the end result, running git reset <commit you want to be squashed offof> and then running a manual git add and commit there. That’s basically all a squash is.
But what you’ll be left with us a single commit that contains all of the code from the branch you’re squashing and also all the code pulled in from every branch you merged, all written as though it all came from this one commit. And maybe that’s what you want? But it feels like also maybe it’s not?
I don’t work with merges, so maybe I’m way off base, but I thought they meant, they’re working on another branch or fork, then merging the base branch into theirs every so often to get the newest changes, and then that creates multiple merge commits, which they can’t squash at the end…?
I’m not sure, about that last part, but the rest, I’ve definitely seen with contributors that didn’t know to work with rebases (and unfortunately we’re on GitHub, which only half-assedly supports working with rebases by default).
I never thought about it and instantly wanted to reply “wait why can’t you do that‽” but now that I thought about it, what would you want the history to look like in that case? A slightly weird rebase? A single commit which seemingly copy pasted the entire other branch with no relation to it left behind?
Sometimes you really don’t want to look over the commit history of your colleagues. As long as it’s a small feature, a single commit is a pretty good option.
Rather than:
Yeah, I’m with you. I mean, git isn’t magic. You “can” squash anything, including a merge commit, by just being at the end result, running
git reset <commit you want to be squashed off of>and then running a manual git add and commit there. That’s basically all a squash is.But what you’ll be left with us a single commit that contains all of the code from the branch you’re squashing and also all the code pulled in from every branch you merged, all written as though it all came from this one commit. And maybe that’s what you want? But it feels like also maybe it’s not?
I think it doesn’t really make sense. Because you can’t “squash” one commit. squash is taking multiple commits and making them one.
When you do a “squash merge” you are really saying “squash all the commits that are on this branch and not the target” then merge.
So you can’t “squash a merge commit” you need at least one additional commit to squash in.
I don’t work with merges, so maybe I’m way off base, but I thought they meant, they’re working on another branch or fork, then merging the base branch into theirs every so often to get the newest changes, and then that creates multiple merge commits, which they can’t squash at the end…?
I’m not sure, about that last part, but the rest, I’ve definitely seen with contributors that didn’t know to work with rebases (and unfortunately we’re on GitHub, which only half-assedly supports working with rebases by default).