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

Re: Can I fetch an arbitrary commit by sha1?

From
Christian Halstrick <christian.halstrick@gmail.com>
Date
Oct 5, 2014, 20:49 UTC
Message-ID
<CAENte7gQm-Mb=73M9dv=vR+N8y=tUsrhLdrwDu4LxOcEFKNB3g@mail.gmail.com>
In-Reply-To
<20141002173551.GA12591@google.com>

I also like the feature of being able to fetch commits by SHA-1. My problem is that it is not clear to end users whether they can fetch SHA-1 from a specific server or not. For exactly the same server a "git fetch origin <id-of-commit-x>" first doesn't work and all of the sudden that command works and updates e.g. FETCH_HEAD. That's because between the first and the second fetch you fetched that commit already by fetching a branch.

And even if the commit is known only to the local repo then the fetch works. I tried to fetch a commit which I just created locally. And the output is:

> git fetch eclipse 382dfeab0e11bd88388d7195114c046c3ec27d8f
From https://git.eclipse.org/r/jgit/jgit
 * branch            382dfeab0e11bd88388d7195114c046c3ec27d8f -> FETCH_HEAD

This gives me the impression that that update was triggered by data coming from the server https://git.eclipse.org/r/jgit/jgit. But the server doesn't know the commit. In my eyes the fetch should fail if the server doesn't know the commit.

Ciao
  Chris
Previous: Jonathan NiederNext: Patrick Donnelly
Message 5 of 12 in “Can I fetch an arbitrary commit by sha1?”
  1. Christian HalstrickOct 2, 2014
  2. Dan JohnsonOct 2, 2014
  3. Jeff KingOct 2, 2014
  4. Jonathan NiederOct 2, 2014
  5. Christian HalstrickOct 5, 2014
  6. Patrick DonnellyOct 6, 2014
  7. David LangOct 6, 2014
  8. Duy NguyenOct 7, 2014
  9. Duy NguyenOct 7, 2014
  10. Junio C HamanoOct 7, 2014
  11. Duy NguyenOct 8, 2014
  12. Junio C HamanoOct 9, 2014

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.