Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zsh: no matches found: HEAD^ #449

Closed
adamstac opened this issue Jun 28, 2011 · 16 comments
Closed

zsh: no matches found: HEAD^ #449

adamstac opened this issue Jun 28, 2011 · 16 comments

Comments

@adamstac
Copy link

When I run this git command, git reset --soft HEAD^ I get this back zsh: no matches found: HEAD^

I have these plugins in place plugins=(brew bundler git osx rails3 ruby textmate)

@sunaku
Copy link
Contributor

sunaku commented Jun 28, 2011

Escape the ^ in your command:

git reset --soft HEAD\^

@adamstac
Copy link
Author

Sweet. Thanks for the tip, that did it.

@daviddavis
Copy link
Contributor

Yea, this is a problem in zshell. You can alternatively can use HEAD~ so that you don't have to escape it each time.

@sunaku
Copy link
Contributor

sunaku commented Jun 29, 2011

Actually, this problem is due to a setting in oh-my-zsh's bare bones configuration. It does not occur with plain old ZSH:

$ zsh -f 
ratham% echo HEAD^
HEAD^
ratham% 

So perhaps this issue should be reopened.

@daviddavis
Copy link
Contributor

So I had this problem long before I started using oh-my-zsh.

Using the exact same setup as the OP (but without rvm installed):

davidd@hal9000 .dotfiles % g co HEAD^
M vim/bundle/vim-rails
M zsh/path.zsh
...

Here's zsh with simply rvm added:

davidd@hal9000 .dotfiles % zsh -f
hal9000% source "$HOME/.rvm/scripts/rvm"
hal9000% g co HEAD^
zsh: no matches found: HEAD^

@sunaku
Copy link
Contributor

sunaku commented Jun 29, 2011

Excellent find! Please report this on the RVM issue tracker as well.

@sunaku
Copy link
Contributor

sunaku commented Jun 29, 2011

I dug some more and found the real culprit:

# after loading RVM
$ unsetopt extendedglob
$ echo HEAD^
HEAD^

@daviddavis
Copy link
Contributor

Ohhh, it looks like ^ filters out symbolic links in extendedglob. Ok, I think this working as intended then.

@blueyed
Copy link
Contributor

blueyed commented Jun 30, 2011

From man zshall:

^x (Requires EXTENDED_GLOB to be set.) Matches anything except the pattern x. This has a higher precedence than /', so^foo/bar' will search directories in .' except./foo' for a file named `bar'.

@cassiemeharry
Copy link

For people who are searching for a solution, another way to fix this is to setopt NO_NOMATCH, which passes the bad match onto the command.

@sunaku
Copy link
Contributor

sunaku commented Jul 13, 2012

Awesome tip! unsetopt nomatch FTW. :-)

@ku1ik
Copy link

ku1ik commented Apr 23, 2013

@nickmeharry 😍

@bric3
Copy link
Contributor

bric3 commented Jan 8, 2014

Oh yeah thanks a lot for the tip @nickmeharry it helped for other issues as well, thx !

elthariel pushed a commit to elthariel/myconf that referenced this issue Apr 3, 2014
@suniakalra
Copy link

Yes this line fixed the issue.. thanks

ninrod added a commit to ninrod/dotfiles that referenced this issue Apr 28, 2016
pierrechevalier83 added a commit to pierrechevalier83/prezto that referenced this issue May 17, 2016
As describe here: ohmyzsh/ohmyzsh#449

I need HEAD^ and similar to work properly
@cdekok
Copy link

cdekok commented Jul 21, 2016

Shouldn't this be the default behaviour ? took me some time to find the setopt NO_NOMATCH

@ZHThinker
Copy link

sweet! @nickmeharry

pierrechevalier83 added a commit to pierrechevalier83/prezto that referenced this issue Oct 22, 2017
As describe here: ohmyzsh/ohmyzsh#449

I need HEAD^ and similar to work properly
flrntpt added a commit to flrntpt/dotfiles that referenced this issue Sep 14, 2018
lettertwo added a commit to lettertwo/config that referenced this issue Jan 22, 2020
opdavies added a commit to opdavies/dotfiles.nix that referenced this issue Jun 20, 2020
Add `options.zsh` and use `setopt NO_NOMATCH` to pass the bad match onto
the command as per
ohmyzsh/ohmyzsh#449 (comment).

Fixes #14
flrntpt added a commit to flrntpt/dotfiles that referenced this issue Jul 30, 2021
flrntpt added a commit to flrntpt/dotfiles that referenced this issue Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants