MichaelAquilina / zsh-you-should-use

📎 ZSH plugin that reminds you to use existing aliases for commands you just typed
GNU General Public License v3.0
1.42k stars 44 forks source link

Git alias matching ignores parameters #66

Closed crater2150 closed 5 years ago

crater2150 commented 5 years ago

The matching for git aliases ignores parameters that may be included in the alias. This causes YSU to recommend aliases that do something different (and in my case even are longer than the command I typed). YSU should only recommend aliases, that do not contain parameters not included in the command.

Example:

I have an alias, that allows me to redo the last commit with git recommit:

alias.recommit commit --amend --reuse-message=HEAD

Now, for any git-commit command the alias is suggested, even though using it would do something different:

% git commit -m 'Add stuff'
Found existing git alias for "commit". You should use: "git recommit"
MichaelAquilina commented 5 years ago

That is definitely unexpected behaviour! Thanks for the bug report :)

Would you prefer to have a go at fixing this yourself or prefer for me to fix it?

crater2150 commented 5 years ago

I already have a partial solution, I'll send a PR sool.