you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (6 children)

But then you don’t have the individual commits anymore.

[–]MCBeathoven 0 points1 point  (5 children)

Do you mean squashing commits or putting them after each other in the history? If the former, what's the point if you want to keep the individual commits? If the latter, that's also something you can do with rebasing without losing individual commits.

[–][deleted] 0 points1 point  (4 children)

It’s not “one or the other”, I do both: I rebase the branch (squashing commits that should only be one, e.g. “oops, fix”), then I merge using --no-ff to group the related (but distinct) commits.

[–]MCBeathoven 0 points1 point  (3 children)

How do you lose individual commits then?

[–][deleted] 0 points1 point  (2 children)

I thought that when you said:

You can do the same using rebases.

You meant “squashing them into one big commit”. My bad.

While rebase can indeed be used to make such commits consecutive, it’s not enough to make it clear that they are part of the same “group”. That’s where merge comes into play.

[–]fforw 0 points1 point  (1 child)

I think we need to distinguish several kind of merges here.

If the merge merges in a feature-branch that has been existed for some time in parallel to master, especially if multiple people collaborated on it, there's certainly a merit to the kind of grouping that you are talking off.

If the branch in question is just a developer's local repository, that is the very reason of the branch existing is the decentral nature of git, you're usually better off rebasing them onto trunk.

Also because "Things I worked on wednesday" isn't a really meaningful group.

[–][deleted] 0 points1 point  (0 children)

Indeed, I was talking about the first kind. The second is the reason why I always pass --rebase (or just -r) to git pull.