Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ZSH Shell support - Bug with a special character



On 28 February 2014 20:54, Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
> Peter Stephenson wrote:
>> Tobias <tobias.basteiro@xxxxxxxxxxxxxxx> wrote:
>>> I'm just trying to run this script:
>>>      git reset HEAD^
> [...]
>>>      zsh: no matches found: HEAD^
> [...]
>> If you don't need it, simply remove it from the start up file where it's
>> turned on or add "unsetopt EXTENDED_GLOB" after whatever code is setting
>> it.
>>
>> If you do need EXTENDED_GLOB for other purposes but don't need that
>> particular syntax, and you have the latest version of zsh, you can turn
>> off that pattern character,
>>
>> disable -p '^'
>
> For completeness: Since ^ is just a globbing character with EXTENDED_GLOB,
> like * or ? are with normal globbing, you can also just:
>
>   % git reset 'HEAD^'
>
>   or
>
>   % git reset "HEAD^"
>
>   or
>
>   % git reset HEAD\^
>
> But since the Tobias thought the behaviour was a bug, he' probably okay
> with Peter's `disable' advice.

You can also just do
% git reset HEAD~
which has the advantage of not being shifted on american keyboards,
and doesn't require escaping in zsh. (As a side note, you can also do
git symbolic-ref h HEAD and then you can say git reset h~ (yes, I'm
very lazy)).

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author