Re: Itches with the current rev spec

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

 



Ramkumar Ramachandra <artagnon@xxxxxxxxx> writes:

> Hi,
>
> So, I have three serious itches that would be nice to address:
>
> 1. git reset --hard HEAD~1/ git show HEAD~1 is a very common idiom
> that's unnecessarily cumbersome to type out.  We can make the <rev>
> part of <rev>~<n> optional without being ambiguous: you might argue
> that ~<n> normally refers to a /home/<n>, but who uses numbers in
> place of usernames?  Even if they do, how can that path possibly be
> inside our repository?

It's a bit more complex than that: the ~<username> is expanded by the
shell, before Git has any opportunity to guess anything.

~1 would be unusable for zsh users and tcsh users at least by default:

zsh% echo ~1
zsh: not enough directory stack entries.

tcsh% echo ~1
Unknown user: 1.

(An obvious workaround is to shell-quote it, but as the goal is to have
something easy to type, \~1 or '~1' do not give so much benefit over
HEAD~1)

That said, it seems to work fine for bash (even if the number is a PID,
it's not expanded), so it may be a good idea to add it as a shortcut,
with a warning in the doc about shell expansion.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
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]