I want clean history, but that really means (a) clean and (b) history.

People can (and probably should) rebase their private trees (their own work). That’s a cleanup. But never other peoples code. That’s a “destroy history”

So the history part is fairly easy. There’s only one major rule, and one minor clarification:

  • You must never EVER destroy other peoples history. You must not rebase commits other people did.

[…]

If you are working with git together with other people, it’s worth a read.

  • magic_lobster_party@fedia.io
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    I think this is dependent on context. Linus is working with a very public repository. Private repositories shared with a small team have different conditions.

    What works in my smallish team at my company is:

    • Enable squash commits. Each PR should be squashed to a single commit. This makes the master branch linear and simple. This ensures each individual commit on master has been reviewed and is in a working state.
    • You can do whatever shit you want on your own branch. It’s going to be squashed anyway.
    • Don’t base your work on some other team member’s branch, unless agreed upon. That’s their work. You should only depend on the master branch.
    • Never rewrite what has already been committed to the master branch.