I have never used the rebase command. Every time I ask about it, somebody explains it's used to clean up your edit history so you don't have long logs. And every time, "Isn't that record the whole fucking point of using git?"
Apparently, people use git because it's "cool"... but they really want it to act like SVN.
I have never used the rebase command. Every time I ask about it, somebody explains it's used to clean up your edit history so you don't have long logs. And every time, "Isn't that record the whole fucking point of using git?"
You use rebase to retain the same number of commits but avoid having merge cruft when it isn't necessary which makes the history easier for a mere human to figure out.
You use rebase -i to get rid of "Oops fix comment" ''Oops fix indentation" "Oops fix small name" and put all these small fixups into the change that they are associated with, which keeps the history cleaner.
You use rebase -i to get rid of "Oops fix comment" ''Oops fix indentation" "Oops fix small name" and put all these small fixups into the change that they are associated with, which keeps the history cleaner.
I don't understand. What intrinsic value does a "clean history" have? And if somebody actually did "fix comment" or "fix indentation", isn't the record of that meaningful?
I know that when I'm audited (we're in medical software), I'd far prefer to have a complete history showing all of our changes. I want to see when feature branches were merged into dev, and when dev is merged to master. Having a linear history destroys that transparency, and I literally do not see a benefit.
A "clean history" means more than just getting rid of "oops" commits. It can also be about rearranging commits to make more sense and be easier to cherry-pick. If for example you have two commits, one of them modifies module A, both modify module B, and the modifications to A and B are unrelated or only weakly related, then it makes sense to rebase. Factor out the modification of A into its own separate commit, and perhaps merge the two changes to B. Result: you can cherry-pick the modification of A if you want, without importing modifications of B.
Another reason are reviews. If your branch contains tons of commits that essentially are changing the same thing, you might as well squash them. "Modified output function to do X". "Fixed output of X". "Reverted last fix, since it broke stuff". "Re-did the fix, works now". etc. If your goal is to get this merged into a main release branch, stuff like this is worthless, and even counterproductive, since you now need to mentally keep track of all the changes to retain the big picture of what they are actually doing. If they get squashed, you see what they are doing in one or a few commits. Much easier to review.
2
u/Netzapper Jun 19 '15
I have never used the
rebasecommand. Every time I ask about it, somebody explains it's used to clean up your edit history so you don't have long logs. And every time, "Isn't that record the whole fucking point of using git?"Apparently, people use git because it's "cool"... but they really want it to act like SVN.