News for hackers. Stuff that matters.
Re:Git: Using Advanced Rebase Features for a Clean Repository by radiospiel on Wednesday August 09, 2017 @06:50AM (#14967310)
I personally almost never rebase and/or squash, since I think that the information that gets lost (like: when was it started, what were mistakes along the lines) might be useful for future understanding of how the project work evolved over time, and what adjustments should/could be made to the development process.

But I understand that a screen as shown in the article is not immensely usuful. But if it comes down on how to present git history information to users, maybe an additional aproach would be to come up with a better presentation layer (that, for example, could hide merge commits, "squashes" branches, etc.

Re:Git: Using Advanced Rebase Features for a Clean Repository by jeff_vader on Wednesday August 09, 2017 @07:41AM (#14967573)
Say we work together. Why would you want to see my 5 solutions to a problem in `master`, of which 4 actually never really ran in production? I do commit often, things that I try and later throw away are in the history. Once rebased and squashed, only final solution is in `master` history.
Re:Git: Using Advanced Rebase Features for a Clean Repository by chii on Wednesday August 09, 2017 @08:07AM (#14967727)
> 4 actually never really ran in production?

but the history showed that it was tried (and perhaps the commit message can have a short note on why it wasn't selected).

without the git history, you'd have to rely on human memory to know this. Or a separately maintained documentation (which, lets face it, is never going to get updated).

Re:Git: Using Advanced Rebase Features for a Clean Repository by Tade0 on Wednesday August 09, 2017 @08:59AM (#14968225)
Or store it in another branch - that's the approach we had been using in one company I worked at.
Re:Git: Using Advanced Rebase Features for a Clean Repository by radiospiel on Wednesday August 09, 2017 @02:56PM (#14972441)
Ah, yes, this was implied :) only working code (as checked via CI) is allowed to show up in master and other long living branches.
Re:Git: Using Advanced Rebase Features for a Clean Repository by branja on Wednesday August 09, 2017 @08:06AM (#14967721)
This is much easier when I actually need to trawl through history to find things.
Re:Git: Using Advanced Rebase Features for a Clean Repository by splike on Wednesday August 09, 2017 @07:09AM (#14967414)
I think there are two perfectly acceptable schools of thought.

One says that the history should be preserved exactly, because its important we keep a record of exactly what happened.

The second says that its ok to rewrite history a little if that makes it more understandable.

I think you would put yourself in the first, and that's ok. I would put myself in the second because at the end of the day I value understanding over precision in git histories. I'm of the opinion that one cares about the commit I made to correct a missing semicolon.

Re:Git: Using Advanced Rebase Features for a Clean Repository by hdhzy on Wednesday August 09, 2017 @07:18AM (#14967463)
The usual rule of thumb is not to modify (e.g rebase) published commits. So it's perfectly fine to adjust local commits before they go into centralized repo - from the point of view of an external observer the history is never destructively modified. This rule can be extended to topic branches or user owned branches with the caveat that others should not base their work upon the topic branch.

Also remember git push --force-with-lease!

Re:Git: Using Advanced Rebase Features for a Clean Repository by james-skemp on Wednesday August 09, 2017 @02:51PM (#14972398)
And `git commit --amend`

I missed a semi-colon or a file? I probably noticed right after I made the commit (and before I pushed it to the remote branch).

Re:Git: Using Advanced Rebase Features for a Clean Repository by maxxxxx on Wednesday August 09, 2017 @12:50PM (#14971091)
I am in the first because I don't think you should change history. But I think there is a need for tools that can show history like it would look after rebasing and squashing.
Re:Git: Using Advanced Rebase Features for a Clean Repository by fulafel on Thursday August 10, 2017 @01:14AM (#14976640)
Maybe we need another layer of abstraction, maybe recorded as merge commits, that would present the summarized history.
Re:Git: Using Advanced Rebase Features for a Clean Repository by lomnakkus on Thursday August 10, 2017 @02:38AM (#14977043)
I really don't need to see all your false starts at a solution to the problem. I don't mean that in a patronizing way, it's just that it is truly irrelevant when I'm digging through commit history.

Question: Do you have a problem with rebase-before-push?

Regardless, there's a happy medium here: Just commit whenever you feel like it, then rebase, squash or whatever just before you're reasonably(!) confident in your approach... and push. Obviously you don't want to force-push, so at the point that you're "reasonably confident" you're committed. If you need to retrace your steps, you just do that through normal "git revert" or whatever.

The point of the above being: This way of working preserves the useful parts of history and you still avoid the absurd noise of seeing everybody's "I changed a thing" commits and non-compiling-commits as well.

Re:Git: Using Advanced Rebase Features for a Clean Repository by UK-AL on Wednesday August 09, 2017 @07:15AM (#14967446)
The thing is I commit very frequently, and a lot of the commits don't really make much sense by themselves. Often with stuff that's just plain wrong or confusing inbetween.
Re:Git: Using Advanced Rebase Features for a Clean Repository by test1235 on Wednesday August 09, 2017 @07:51AM (#14967631)
e.g. remove console.log

what do you need that in the git history for?

Re:Git: Using Advanced Rebase Features for a Clean Repository by epmatsw on Wednesday August 09, 2017 @10:34AM (#14969337)
“Fix lint” is my favorite one.
Re:Git: Using Advanced Rebase Features for a Clean Repository by AstralStorm on Wednesday August 09, 2017 @01:47PM (#14971753)
My unfavorite is WIP and "update submodule(s)". In fact I contemplated making a git hook to reject such drivel on merge.
Re:Git: Using Advanced Rebase Features for a Clean Repository by 0xcoffee on Wednesday August 09, 2017 @08:33AM (#14967937)
I wish there was some happy medium, like that I can merge a branch and it gets squashed into a single commit, but then if needed I can 'expand' that commit to see its contents, even after the other branch is deleted.
Re:Git: Using Advanced Rebase Features for a Clean Repository by falsedan on Wednesday August 09, 2017 @10:33AM (#14969325)
That’s a rebased branch. You can see just the changed introduced by a branch:

  MERGE_COMMIT=$(git rev-parse :/“Merge .*$branchname”)
  git diff $MERGE_COMMIT^1..$MERGE_COMMIT^2
It never occurred to me that people prefer to squash so they can avoid the crummy UI of git diff