5 ms·
Squashing is rewriting history. It sounds like the grandcomment had a ban against rewriting history across-the-board, which would help make git idiot proof. I
by prettyStandard 4y ago
Squashing is rewriting history.
It sounds like the grandcomment had a ban against rewriting history across-the-board, which would help make git idiot proof. I love rewriting history, not because it's what I wished I had done but because it's what I am going to want to review when I have to.
Rewriting history is a great way for gitiots to shoot themselves in the foot.
- peteradio 4y agoCouldn't you rewrite history locally on your own branch and nobody would know?
- prettyStandard 4y agoYeah... You should never rewrite history of shared branches. You are just asking for trouble in that case.
- danpalmer 4y agoWe informally allowed whatever you wanted until you opened a pull request.
- chrisfinazzo 4y agoHard agree. Do whatever the heck you want locally, just try not to screw everybody else up when you push. (From the guy who force-pushed on a personal project yesterday to resolve a situation with multiple remote heads - I am ashamed)
- opsy_ 4y agoSure, unless you bork your local repo enough you need help from a teammate getting your work into a PR. Not to say that doesn't make for a good learning moment.
- OkayPhysicist 4y agoAt some point, every junior is going to mangle something, and need a senior to sit them down and give them the git reflog talk. It's an inevitability, and should be embraced as a natural part of the evolution of a developer.
- prettyStandard 4y agoHaha. what's the git reflog talk? To be clear I know what reflog is, but what's "the talk"?
- olddustytrail 4y agoProbably just making them aware of it. But I can give a slightly longer spiel: Commits in git are immutable. They're identified by their hash, so they have to be. What's more they have the hash of the previous commits so the whole chain back to the first commit can't be changed. You can only add new chains. As a consequence, if your main branch points to commit abc123 and your feature branch points to commit def456 then it doesn't matter if you merge, cherry pick, rebase or dance the fandango, if you point those branches back to those commits, the branches must by necessity look identical to the way they looked before you did anything. And you can find out where they used to point in the reflog.
- chrisfinazzo 4y agoI'm certainly aware of reflog and have (thankfully) only had occasion to use it once or twice that I can remember. To my original comment - having to force-push in order to resolve heads - is there a "correct" way to do this that doesn't feel gross?
- Dylan16807 4y agoYou're going to have to explain your problem in more detail than "resolve a situation with multiple remote heads".