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

Re: Can I fetch an arbitrary commit by sha1?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 2, 2014, 17:35 UTC
Message-ID
<20141002173551.GA12591@google.com>
In-Reply-To
<20141002161006.GB2505@peff.net>
Jeff King wrote:
Show 9 quoted lines
> But I think Christian is arguing that the client side should complain
> that $sha1 is not a remote ref, and therefore not something we can
> fetch.  This used to be the behavior until 6e7b66e (fetch: fetch objects
> by their exact SHA-1 object names, 2013-01-29). The idea there is that
> some refs may be kept "hidden" from the ref advertisement, but clients
> who learn about the sha1 out-of-band may fetch the tips of hidden refs.
>
> I'm not sure it is a feature that has been particularly well-used to
> date, though.

I use it pretty often. The commits I'm fetching are pointed to directly by refs, but I don't care about what the ref is called and I want exactly that commit.

The context is that the commit is mentioned in the gerrit web UI. Fetching by commit name feels simpler than getting the refs/changes/something ref, since I think in terms of commits instead of in terms of change numbers.

Thanks and hope that helps, Jonathan

Previous: Jeff KingNext: Christian Halstrick
Message 4 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.