git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git revert with partial commit.

From
Sergey Organov <sorganov@gmail.com>
Date
Apr 5, 2023, 06:39 UTC
Message-ID
<87wn2qg7du.fsf@osv.gnss.ru>
In-Reply-To
<CAMP44s2od_=3p8+GF7tSBqQ0KsDaa4qVKXS66BS7L7BJadA_Xw@mail.gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 49 quoted lines
> On Tue, Apr 4, 2023 at 3:08 PM Sergey Organov <sorganov@gmail.com> wrote:
>>
>> Junio C Hamano <gitster@pobox.com> writes:
>>
>> > Sergey Organov <sorganov@gmail.com> writes:
>> >
>> >>> This kind of operation produces a new commit, so there's no such
>> >>> thing as a partial revert or partial cherry-pick, at least in
>> >>> terms of "things Git can do by itself".  But we, as humans writing
>> >>> programs, wish to *achieve* such things.
>> >>
>> >> So, why Git can't help us achieving it by supporting paths limiting in
>> >> (all) merge operations? There seems to be no absolute obstacles, just a
>> >> luck of support.
>> >
>> > I think there is no fundamental reason to forbid an optional
>> > pathspec to "cherry-pick" and "revert", given that a commit that
>> > results from either "git cherry-pick" or "git revert" is called a
>> > "cherry-pick" or a "revert" merely by convention and there is no
>> > tool-level support to treat them any specially at merge or rebase
>> > time [*1*].  It would make it harder to design tool-level support
>> > for full cherry-picks or reverts, but that is a problem for future
>> > generation, not ours ;-)  Allowing pathspec to "merge" and recording
>> > the result as a merge of two (or more) parents is an absolute no-no
>> > but that is not what we are discussing.
>>
>> If I got this right, you believe that "git merge" should never have
>> support for "partial merges", whereas it makes sense for cherry-pick and
>> revert? If so, I disagree. There is no reason for Git to strictly
>> prevent me from using the feature specifically in "git merge" (once it's
>> otherwise implemented), provided I do mean it and didn't do it by
>> mistake.
>>
>> Please notice that I can do it right now already (and I did a few
>> times), only with a more pain than necessary, and I don't see why this
>> pain is to be preserved (provided we do have the feature implemented in
>> the future). Besides, "git merge" is only a helper, and it'd be an
>> improvement if it'll be capable to help in more cases.
>
> This sounds awfully familiar to Mercurial's reluctance to support
> rewriting history. It wasn't the tool's place to prescribe what the
> users should or shouldn't do.
>
> If the user wants to do it, the tool should help him do it, not
> pontificate about what is heretic.
>
> The user is still going to do it, like with a rebase plugin on
> Mercurial, or with `git filter-branch` and then merge the result. All
> the tool is achieving is being annoying by not helping the user.

Yep, and I'm worried by such trends in Git as well. Looks like growing influence of software development culture where the user is not considered to be intelligent enough to make proper decisions by himself, and needs to be thoroughly guided by the tool (designers) all the time.

Thanks, -- Sergey Organov

Previous: Felipe ContrerasNext: Felipe Contreras
Message 15 of 18 in “git revert with partial commit.”
  1. Hongyi ZhaoApr 2, 2023
  2. Torsten BögershausenApr 2, 2023
  3. Junio C HamanoApr 3, 2023
  4. Hongyi ZhaoApr 4, 2023
  5. Phillip SusiApr 3, 2023
  6. Hongyi ZhaoApr 4, 2023
  7. Hongyi ZhaoApr 4, 2023
  8. Hongyi ZhaoApr 4, 2023
  9. Chris TorekApr 4, 2023
  10. Sergey OrganovApr 4, 2023
  11. Junio C HamanoApr 4, 2023
  12. Sergey OrganovApr 4, 2023
  13. Junio C HamanoApr 4, 2023
  14. Felipe ContrerasApr 4, 2023
  15. Sergey OrganovApr 5, 2023
  16. Felipe ContrerasApr 7, 2023
  17. Sergey OrganovApr 7, 2023
  18. Phillip SusiApr 6, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.