Re: [PATCH 0/2] advise about force-pushing as an alternative to reconciliation
- From
Alex Henrie <alexhenrie24@gmail.com>
- Date
- Jul 6, 2023, 02:32 UTC
- Message-ID
- <CAMMLpeRPcw8WbGJwbeS_E+qxKvCukNc3g-3BXeNP5BrRJJ5ifA@mail.gmail.com>
- In-Reply-To
- <xmqq5y6z3oym.fsf@gitster.g>
On Tue, Jul 4, 2023 at 11:30 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> I think the description in the cover was prone to be misunderstood, > but I think I got it now. Where you are pushing from your topic > branch is your "publishing" branch that only you would push into, > and the primary way you update it is by rebasing your local copy of > it on the updated 'master' branch to keep up with others' work > integrated into the shared 'master'.
Right. It's a narrow case, but it's quite common. For example, GitHub and GitLab keep permanent references to every version of a branch that was pushed while a pull request was open for that branch. On those platforms, force-pushing is analogous to emailing a new version of a patchset.
Show 11 quoted lines
> In such a workflow, the way to update your "publishing" branch will > normally be to force push to overwrite. And in this very narrow use > case, where nobody else is pushing into your "publishing" branch, > your remote-tracking branch would be always up-to-date with the > remote repository and use of --force-with-lease that does not say > which commit you expect there to be is safe. In fact, you do not > even have to use --force-with-lease in such a use case, because its > additional safety (relative to --force) relies on the assumption > that you would be the only one who is pushing into the remote > repository to update that branch---and at that point, --force > without lease is just as good.
OK, I'll switch back to --force in v3. Thanks for the feedback!
-Alex