0

I need to use git format-patch to download multi a commits depend on from some SHA to other SHA ... Not single diff patch ...

for example I want to download from this source https://github.com/GStreamer/gstreamer/commits/main?after=93b896eb4edc035d9ccc56a680a34e83aa18bb42+34&branch=main&qualified_name=refs%2Fheads%2Fmain

I need to download all commits from (pbutils: descriptions: add meta/x-klv) to (ci: Bump meson to 0.62.2 in Fedora docker images) only ?!! This is just example !!

fairbird
  • 35
  • 1
  • 6
  • Have you seen https://stackoverflow.com/questions/18679870/list-commits-between-2-commit-hashes-in-git ? – MSalters Oct 07 '22 at 11:48
  • Yes but did not help me ... I need to create patches from my locale source on linux not print list of commits from online .. with `git format-patch` ot any other commands – fairbird Oct 07 '22 at 12:04
  • Either you don't understand git, or I don't understand your question. Git works with repositories, commits are changes to repositories. You can clone an entire repository, but it's quite unclear if you have done so. If you already have a local repository cloned from Github, why would you then download commits? And if you don't have a local repository, then why do you comment about "create patches from local source" ? – MSalters Oct 07 '22 at 12:19
  • I need to download some patches commit around (50) from some repositories and then apply it on other project.... It is not important to collection patches from my locale. It is ok If there is any way yo download it online from source. But I need to download some commits (from some SHA to SHA) – fairbird Oct 07 '22 at 12:55
  • Just to check, the "other project" is somehow related so the patches do make sense, but git doesn't understand the connection? You lost the git history or so? – MSalters Oct 07 '22 at 13:59
  • No. I did not lost (git history).. – fairbird Oct 07 '22 at 15:13

2 Answers2

1

format-patch takes the usual gitrevisions format. Just leave out the -1 (single commit) argument and specify sha1...sha2 range.

MSalters
  • 173,980
  • 10
  • 155
  • 350
  • How to use it gitrevisions to catch and download patches ?!! Can you give example please ?! – fairbird Oct 07 '22 at 15:16
  • @fairbird: `gitrevisions` isn't a tool. It's the git format to specify what you want: one commit, all commits since a certain commit, or (for your case) a range. The example is already in: `sha1...sha2`, Those are the SHA hashes of the first and last commits. – MSalters Oct 07 '22 at 16:05
  • I have understood what you advice but how to use it gitrevisions ?!! for example If I have from `sha1` to `sha100` and I want just download all commits just from `sha20` to `sha50` how to use `gitrevisions` ?!! – fairbird Oct 07 '22 at 20:57
0

found way by this commit

git format-patch bc6a2dd1c8552cd67612dc728e0b7525e90b036e -10

The command will be download patches start with bc6a2dd1c8552cd67612dc728e0b7525e90b036e and them latest 10 commits after that SHA

fairbird
  • 35
  • 1
  • 6