Skip to content

CONTRIBUTING.md: simplify rebasing instructions#175352

Merged
piegamesde merged 1 commit intoNixOS:masterfrom
ncfavier:contributing-simplify-rebase
Aug 15, 2022
Merged

CONTRIBUTING.md: simplify rebasing instructions#175352
piegamesde merged 1 commit intoNixOS:masterfrom
ncfavier:contributing-simplify-rebase

Conversation

@ncfavier
Copy link
Member

@ncfavier ncfavier commented May 29, 2022

Makes the instructions easier to remember (and type) using the git rebase --onto A...B syntax to find the merge base between A and B (which has been in git for at least 10 years).

We also assume that the merge base between staging and master is also the merge base between staging and the current branch (since it is based on master)

Also, giving master as the <upstream> branch makes git consider the commits in the current branch that are not in master, so there's no need to compute the merge base between master and the current branch.

In the same spirit of discouraging copy-and-paste, use a placeholder name for the current branch instead of $(git branch --show-current).

Makes the instructions easier to remember (and type) using the
`git rebase --onto A...B` syntax to find the merge base between A and B
(which has been in git for at least 10 years).

We also assume that the merge base between staging and master is also
the merge base between staging and the current branch (since it is based
on master), and giving master as the <upstream> branch makes git
consider the commits in the current branch that are not in master, so
there's no need to compute the merge base between master and the current
branch.

In the same spirit of discouraging copy-and-paste, use a placeholder
name for the current branch instead of `$(git branch --show-current)`.
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels May 29, 2022
@bobby285271 bobby285271 added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jun 5, 2022
@ncfavier
Copy link
Member Author

bump

@jonringer
Copy link
Contributor

cc some others who might be opinionated

@jtojnar @mweinelt @piegamesde @Artturin

@ncfavier
Copy link
Member Author

ping

@mweinelt mweinelt requested review from Mic92 and dasJ July 30, 2022 19:55
@jtojnar
Copy link
Member

jtojnar commented Aug 1, 2022

The triple dot syntax is documented in git-rebase(1) and it looks like it behaves differently from the merge-base command when there are multiple merge bases. Not sure how often that happens in Nixpkgs.

I am not very familiar with merges in git so I will defer to others.

@ncfavier
Copy link
Member Author

ncfavier commented Aug 2, 2022

Indeed, the ... syntax will fail if there are multiple merge bases. That seems to only happen with criss-cross merges, which I don't think can happen in nixpkgs (at least not between the usual branches) because

  1. they're always merged into each other cleanly (i.e. we never merge an ancestor of branch A into branch B). If you merge B into A and then A into B, that's not a criss-cross merge because A is now the best common ancestor between A and B.
  2. we don't rewrite history. Apparently things like git commit --amend can create criss-cross situations.

At least I've never run into that issue in nixpkgs.

@piegamesde piegamesde merged commit f4e2a3c into NixOS:master Aug 15, 2022
@ncfavier ncfavier deleted the contributing-simplify-rebase branch August 15, 2022 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants