[llvm-dev] Workflow to commit changes using git alone (?)

Mehdi AMINI via llvm-dev llvm-dev at lists.llvm.org
Sun Nov 10 22:10:20 PST 2019


On Sun, Nov 10, 2019 at 2:58 PM Joan Lluch <joan.lluch at icloud.com> wrote:

> Hi Mehdi,
>
> On 10 Nov 2019, at 20:27, Mehdi AMINI <joker.eph at gmail.com> wrote:
>
> No: the arcanist command does not suffer from the problem I was raising.
> The issue I was referring to is that your reset command will lead to
> *undoing* changes from master (unrelated to your branch) when you commit in
> the end (all the changes that are in master but not in "patchbranch").
> (just try to add `git checkout master && git pull && git checkout tmp`
> before your `git reset `, and then look at the resulting commit).
>
>
>
> But I would never do that!. The commands "git checkout master && git pull”
> are only run before the whole procedure, never in the middle.
>

If you have a local `patch branch` branch for your work, *and* you
guarantee that your local master branch never ever diverge separately, then
why do you need another branch in the first place. I may be missing some
key part of your workflow.


> And the patchbranch is always merged with master before starting the
> procedure.
>

If master didn't move then why do you need to merge it?
(always merging master *into* patchbranch before `git reset` is addressing
the problem I mentioned though, it just wasn't part of your steps)


> The Phabricator diff is created by comparing both branches after they have
> merged, and the point of reseting ’tmp' to ‘master’ is to obtain a fresh
> commit containing exactly the same diff.
>

> In any case, I would want to understand why the archaist command does not
> suffer from an “evolving” master, which is the problem that you raised
> first. The “arc patch” command creates a new branch from the local master,
> so the remote repo can still have changed even before the actual command is
> completed (!) or at any time after that. So what makes executing that
> command different?, or maybe I should ask, what is the archaist command
> actually doing in terms of plain git commands?
>

The important part is that there is no `git reset` involved: after running
arcanist you have a branch based of your local master, but you'll still
need to rebase it if the remote master has moved in the meantime before
being able to push.

-- 
Mehdi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191110/f95ac645/attachment.html>


More information about the llvm-dev mailing list