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

Looking for a way to turn off/modify ref disambiguation

From
Nathan W. Panike <nathan.panike@gmail.com>
Date
Aug 23, 2011, 19:26 UTC
Message-ID
<CAPRoxBXjL3Y3KRd8R2guX9Ar374sw-pBhz1bCzNZxn1vC6XNPw@mail.gmail.com>

A colleague at $dayjob recently caused corruption in our git repository by accidentally running the command

git rebase origin stable
where they meant to run
git rebase origin/stable
The git-rev-parse(1) man page says:

... <refname>, e.g. master, heads/master, refs/heads/master

    A symbolic ref name. E.g. master typically means the commit object
referenced by refs/heads/master. If you happen to have both
heads/master and tags/master, you can explicitly say heads/master to
tell git which one you mean. When ambiguous, a <name> is disambiguated
by taking the first match in the following rules:
       1.          If $GIT_DIR/<name> exists, that is what you mean
(this is usually useful only for HEAD, FETCH_HEAD, ORIG_HEAD,
MERGE_HEAD and CHERRY_PICK_HEAD);
       2.          otherwise, refs/<name> if it exists;
       3.          otherwise, refs/tags/<refname> if it exists;
       4.          otherwise, refs/heads/<name> if it exists;
       5.          otherwise, refs/remotes/<name> if it exists;
       6.          otherwise, refs/remotes/<name>/HEAD if it exists.
...

Is there any way to change this behavior, e.g., so that rule 6 becomes an error? Say, by setting a config option?

========== Nathan Panike

Next: Jeff King
Message 1 of 7 in “Looking for a way to turn off/modify ref disambiguation”
  1. Nathan W. PanikeAug 23, 2011
  2. Jeff KingAug 23, 2011
  3. Junio C HamanoAug 23, 2011
  4. Michael J GruberAug 24, 2011
  5. Jonathan NiederAug 24, 2011
  6. Junio C HamanoAug 24, 2011
  7. Clemens BuchacherAug 24, 2011

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.