Re: fatal: ambiguous argument 'HEAD^': unknown revision or path not in the working tree.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> The "simplest" way to do that is:
>
>   rm .git/refs/heads/master
>
> but that is not guaranteed to work in future versions of git, and I
> wouldn't recommend it in general.

Yeah, "git checkout -b" has a stronger sibling "git checkout -B"
(i.e. I know that the named branch already exists, so this is not a
request to create a new one, but to repoint that existing one), but
there is no analogue for "git checkout --orphan".  That could be
worked around with something like this though:

    $ git checkout --orphan hu
    $ git branch -D master
    $ git checkout --orphan master

As I agree with your "amending is better", I do not think allowing
an easier access to such a feature is urgent or important, though.

> Probably a better workflow is to create the commit state you _do_ want
> (change files, "git add" them, etc), and then run "git commit --amend"
> to replace the bad commit.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]