Hi John, Steffen, Andreas, On Thu, May 09, 2024 at 11:51:38PM GMT, Andreas Schwab wrote:
On Mai 09 2024, Steffen Nurpmeso via tz wrote:
git show --no-patch [--pretty=XY] COMMIT
gives the commit object (to the given extend), which can then be parsed and used for example to fill in the environment variables
GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE
for "git commit" accordingly. There you go.
git commit -c <commit> can do that for you, if you fetch the commit into the current repository.
I understand I can do all of that, which is why I said I can manualy, or with some scripts, do that. However, I'd need to at least get each diff separately, modify it with a script that fixes the location of the files, and then commit (with -c). However, if the locations match, it's waaay easier: I can just cherry pick entire ranges of commits blindly: alx@debian:~/tmp/tz$ cd a/ alx@debian:~/tmp/tz/a$ ls -la total 16 drwxrwxr-x 3 alx alx 4096 May 10 00:07 . drwxrwxr-x 4 alx alx 4096 May 10 00:09 .. drwxrwxr-x 8 alx alx 4096 May 10 00:08 .git -rw-rw-r-- 1 alx alx 12 May 10 00:08 a alx@debian:~/tmp/tz/a$ git log --oneline -p -U0 e6aae47 (HEAD -> main) f diff --git a/a b/a index 9405325..0fdf397 100644 --- a/a +++ b/a @@ -5,0 +6 @@ e +f ebac0e4 e diff --git a/a b/a index d68dd40..9405325 100644 --- a/a +++ b/a @@ -4,0 +5 @@ d +e 272741f d diff --git a/a b/a index de98044..d68dd40 100644 --- a/a +++ b/a @@ -3,0 +4 @@ c +d b26242e c diff --git a/a b/a index 422c2b7..de98044 100644 --- a/a +++ b/a @@ -2,0 +3 @@ b +c 4c731b2 b diff --git a/a b/a index 7898192..422c2b7 100644 --- a/a +++ b/a @@ -1,0 +2 @@ a +b 7bc442b a diff --git a/a b/a new file mode 100644 index 0000000..7898192 --- /dev/null +++ b/a @@ -0,0 +1 @@ +a alx@debian:~/tmp/tz/a$ cd ../b/ alx@debian:~/tmp/tz/b$ ls -la total 16 drwxrwxr-x 3 alx alx 4096 May 10 00:10 . drwxrwxr-x 4 alx alx 4096 May 10 00:09 .. drwxrwxr-x 8 alx alx 4096 May 10 00:10 .git -rw-rw-r-- 1 alx alx 4 May 10 00:10 a alx@debian:~/tmp/tz/b$ git log --oneline -p -U0 ff0f291 (HEAD -> main) init b diff --git a/a b/a new file mode 100644 index 0000000..422c2b7 --- /dev/null +++ b/a @@ -0,0 +1,2 @@ +a +b alx@debian:~/tmp/tz/b$ git remote add A ../a alx@debian:~/tmp/tz/b$ git fetch A remote: Enumerating objects: 18, done. remote: Counting objects: 100% (18/18), done. remote: Compressing objects: 100% (6/6), done. remote: Total 18 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (18/18), 5.04 KiB | 1.01 MiB/s, done. From ../a * [new branch] main -> A/main alx@debian:~/tmp/tz/b$ git cherry-pick 4c731b2..A/main [main b302880] c Date: Fri May 10 00:08:14 2024 +0200 1 file changed, 1 insertion(+) [main f37efe2] d Date: Fri May 10 00:08:41 2024 +0200 1 file changed, 1 insertion(+) [main 7bb6704] e Date: Fri May 10 00:08:47 2024 +0200 1 file changed, 1 insertion(+) [main d10ea80] f Date: Fri May 10 00:08:54 2024 +0200 1 file changed, 1 insertion(+) For commits that affect both manual pages and other files, I still need to do some extra work, but significantly less than editing patches. And maybe git-cherry-pick(1) gains the ability to filter paths in the future. Have a lovely night! Alex -- <https://www.alejandro-colomar.es/>