Re: git: 06757954d9e3 - main - Uses/electronfix.mk: revert previous commit

From: Mathieu Arnold <mat_at_freebsd.org>
Date: Wed, 04 Sep 2024 12:28:52 UTC
On Wed, Sep 04, 2024 at 01:28:45PM GMT, Gleb Popov wrote:
> On Wed, Sep 4, 2024 at 1:00 PM Mathieu Arnold <mat@freebsd.org> wrote:
> >
> > The branch main has been updated by mat:
> >
> > URL: https://cgit.FreeBSD.org/ports/commit/?id=06757954d9e3de9472361b4e8db6ffb991c8dcea
> >
> > commit 06757954d9e3de9472361b4e8db6ffb991c8dcea
> > Author:     Mathieu Arnold <mat@FreeBSD.org>
> > AuthorDate: 2024-09-04 09:56:45 +0000
> > Commit:     Mathieu Arnold <mat@FreeBSD.org>
> > CommitDate: 2024-09-04 09:58:07 +0000
> >
> >     Uses/electronfix.mk: revert previous commit
> >
> >     And remove the offending port, it can be added back if the software is
> >     updated to work with a supported electron.
> 
> But because you squashed these two changes, it can't be reverted with
> a single git command.
> 
> You again not waiting a moment to let me do that myself?

There are many way to revert only part of a commit... Without thinking
much, I can see those ways:

1) a simple use of git revert
- git revert -n <commit>
- changes back the changes you don't want to revert
- change files so that it builds
- git commit

2) a variation
- git revert <commit>
- changes back the changes you don't want to revert
- change files so that it builds
- git commit --amend

3) use a modified patch
- git show <commit> > foo.diff
- change the diff to remove what you don't want in it
- git apply -R foo.diff
- change files so that it builds
- git commit

4) change modified files
- git show <commit> | git apply -R
- revert whatever you don't want in
- change files so that it builds
- git commit

5) get files manually
- git checkout <commit>~1
- tar cf logseq.tar textproc.logseq
- git checkout main
- tar xf logseq.tar
- rm logseq.tar
- change files so that it builds
- commit

6) do it manually be a bit tedious
- mkdir -p mkdir -p textproc/logseq/files
- for i in textproc/logseq/Makefile textproc/logseq/distinfo textproc/logseq/files/Logseq.desktop textproc/logseq/files/Logseq.in textproc/logseq/files/patch-resources_app_node__modules__logseq_rsapi-linux-x64-gnu_package.json textproc/logseq/pkg-descr textproc/logseq/pkg-plist ; do git show <commit>~1:$i > $i ; done
- change files so that it builds
- add the port back to textproc/Makefile
- git add / commit

So, I am not sure what you mean by "unable to revert", all the files are
in the history, you can get them back, and "revert" this to a working
version of logseq.

-- 
Mathieu Arnold