All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nathan W. Panike" <nathan.panike@gmail.com>
To: git@vger.kernel.org
Subject: Looking for a way to turn off/modify ref disambiguation
Date: Tue, 23 Aug 2011 14:26:48 -0500	[thread overview]
Message-ID: <CAPRoxBXjL3Y3KRd8R2guX9Ar374sw-pBhz1bCzNZxn1vC6XNPw@mail.gmail.com> (raw)

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

             reply	other threads:[~2011-08-23 19:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 19:26 Nathan W. Panike [this message]
2011-08-23 21:15 ` Looking for a way to turn off/modify ref disambiguation Jeff King
2011-08-23 22:03 ` Junio C Hamano
2011-08-24  9:25   ` Michael J Gruber
2011-08-24 16:37     ` Jonathan Nieder
2011-08-24 17:48     ` Junio C Hamano
2011-08-24  6:54 ` Clemens Buchacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPRoxBXjL3Y3KRd8R2guX9Ar374sw-pBhz1bCzNZxn1vC6XNPw@mail.gmail.com \
    --to=nathan.panike@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.