> Are you sure you wanted to say merge? If the master branch is rewritten into a new branch, feature branches on it would need to be rebased normally.
Yes. The way we currently do things is keeping things as simple as possible for everyone, even if this doesn't produce the prettiest history. A developer first creates their feature branch based off of master, commits several times to this feature branch, tests it and possibly asks for review from a coworker and then they merge this feature branch into master using --no-ff, always creating a merge commit.
It's possible there have been commits to master since they based off of it. If so, they will resolve this in the merge. I do think it would be better if feature branches got rebased prior to merging onto master so they can be tested in this state as well but this is currently not how things are done (it is not up to me). Though that could create issues if there's multiple developers collaborating on a feature branch and they do not communicate properly.
The reason I said "every developer gets to" is that in larger projects (which also usually use gerrit, which do not) I've seen that there are usually a select few people in charge of merging the feature branches into master, instead of everyone getting to merge as they see fit.
My view on rewriting history is that it should not happen on shared branches as this will surely lead to issues where one of the developers does not do the entire 'fetch rebase merge' dance correctly, or works directly on master. We also contract some work out to external agencies and their git usage is usually absymal, and I am not in the position to correct or influence any of that.
> I think tags with descriptions would serve the same purpose. Do you see issues with that?
I'm not sure how the tags with descriptions would help with easily rolling back all the changes introduced through a feature branch, but maybe I'm missing something.
Merging feature branches off of one branch that was rewritten into a new one into the new one is nothing anybody would ever do or recommend. Rebasing is a requirement here, and truthfully an operation with less mental overhead, since it's actually just "copy all of those commits over to here, then put the branch marker at the end of the new copy".
It kind of sounds to me as if you're saying "i don't want my developers to not learn rebase because it's easier if they learn a little less". Is that a correct understanding? If so, then you're trading a little upfront work for a lot of cleanup work later on.
> My view on rewriting history is that it should not happen on shared branches
Depends on how shared they are and how big the fuck-up is. Everything is relative.
> as this will surely lead to issues where one of the developers does not do the entire 'fetch rebase merge' dance correctly
There should not be any merge involved there. See first paragraph.
> or works directly on master.
That developer gets a notice to get his shit together and gets fired if he persists. This is teamwork, not cowboy work.
> I'm not sure how the tags with descriptions would help with easily rolling back
They don't. They help with marking places where old broken branches were abandoned and marking places where their new counterparts were reinstated.
Lastly:
> it is not up to me
If it's not up to you, and they'd not be willing to listen then the conversation is moot and your org is broken. You can't wedge one small part of a rebase-based workflow into a larger workflow that pretends git is just SVN with a different syntax.
I can tell you how to do everything correctly and how it will actually make things nice and smooth, but if everything is not an option, then a little can't be applied to your situation.
> Merging feature branches off of one branch that was rewritten into a new one into the new one is nothing anybody would ever do or recommend. Rebasing is a requirement here, and truthfully an operation with less mental overhead, since it's actually just "copy all of those commits over to here, then put the branch marker at the end of the new copy".
I'm not even sure what you're trying to say here. In general we don't rewrite history of shared branches thus rebasing is certainly not a requirement.
> It kind of sounds to me as if you're saying "i don't want my developers to not learn rebase because it's easier if they learn a little less". Is that a correct understanding? If so, then you're trading a little upfront work for a lot of cleanup work later on.
They're not my developers. I'm one of the developers. I'm trying to educate my coworkers more in the ways of the git, but it's slow progress. There has been no cleanup work so far, mostly because we're not obsessive over having a "clean history", and are instead more than happy with a realistic one.
> Depends on how shared they are and how big the fuck-up is. Everything is relative.
It's not a fuck-up. Bugs happen, noticing and fixing them is progress. The revert commit references the issue tracker, and this itself is valuable history. Instead of the commits simply disappearing for a time.
> That developer gets a notice to get his shit together and gets fired if he persists. This is teamwork, not cowboy work.
Git is there to faciliate teamwork, not to get in the way.
Just to remind you of what the context of this discussion is:
You commented on an article that says, paraphrased: "Stop merging criss and cross y'all, it's dumb and counterproductive; rebase everything instead, it'll help you in the long run."
In that context, you asked "well merge commits are easily to revert, if i can't merge, how to i revert a feature branch?"
I answered to that, in the context given by the article on which you were commenting. That context is: "Rebasing all your things is mandatory."
As i said in my previous post, if you're not willing to even mentally adopt that context, then nothing i can say would be helpful.
Are you interested in doing that?
--
> we're not obsessive over having a "clean history", and are instead more than happy with a realistic one.
I deeply resent the implication. This kind of stance is what led me to my initial post you took offense to. What you perceive as obsession is experience and knowledge by people who have experienced both sides of the coin, along with their benefits and pains, and made a rational decision on which is more favourable in the long term.
You won't find me accusing you of obsession with fixed history just because you haven't had the (mis)fortune to make the full range of experiences on this.
> Instead of the commits simply disappearing for a time.
Nothing disappears, that is specifically why i mentioned tags. If one abandons a branch and the history is valuable to keep around, you stick a tag on the end of that branch, give it a description pointing at the ticket, then put a similar tag on the end of the remade branch, and off you go.
> not to get in the way.
How is git getting in the way of teamwork in your opinion?
> It's not a fuck-up.
Bugs are fuck-ups. There are no two ways around that. Especially when they're bad enough that a feature branch would be removed wholesale, and not simply disabled with a flag.
Yes. The way we currently do things is keeping things as simple as possible for everyone, even if this doesn't produce the prettiest history. A developer first creates their feature branch based off of master, commits several times to this feature branch, tests it and possibly asks for review from a coworker and then they merge this feature branch into master using --no-ff, always creating a merge commit.
It's possible there have been commits to master since they based off of it. If so, they will resolve this in the merge. I do think it would be better if feature branches got rebased prior to merging onto master so they can be tested in this state as well but this is currently not how things are done (it is not up to me). Though that could create issues if there's multiple developers collaborating on a feature branch and they do not communicate properly.
The reason I said "every developer gets to" is that in larger projects (which also usually use gerrit, which do not) I've seen that there are usually a select few people in charge of merging the feature branches into master, instead of everyone getting to merge as they see fit.
My view on rewriting history is that it should not happen on shared branches as this will surely lead to issues where one of the developers does not do the entire 'fetch rebase merge' dance correctly, or works directly on master. We also contract some work out to external agencies and their git usage is usually absymal, and I am not in the position to correct or influence any of that.
> I think tags with descriptions would serve the same purpose. Do you see issues with that?
I'm not sure how the tags with descriptions would help with easily rolling back all the changes introduced through a feature branch, but maybe I'm missing something.