5 ms·
suffix aliases do not even have to refer to a real existing file. They are an alias. That's what I use to clone git repos I copypaste: alias -s git="git clo
by rgrau 6y ago
suffix aliases do not even have to refer to a real existing file. They are an alias. That's what I use to clone git repos I copypaste:
alias -s git="git clone"
- chrisweekly 6y agowat? doesn't this prevent you from doing anything else w git?
- chrisfinazzo 6y agoYeah... Overwriting a command-line tool with no other arguments seems like a bad idea.
- skoskie 6y agoNo, this really only addresses the situation where the URL ends with (suffix) “git”. The only time I use the full URL is the initial cloning, and the remote name thereafter. But if you use the full URL in another scenario, yes, this may interfere.
- deleted 6y ago[deleted]
- gizmo385 6y agoI don't believe so since I think suffix aliases are only affected by the "file extension" of the command you've added. The suffix alias in the OP is saying that if they paste something that ends with ".git", then clone that thing (i.e. if you paste the git url for a repo, it clones it). It doesn't overwrite the git command
- rgrau 6y agoAs others commented, this only acts when the first word in your commandline ends with '.git'. - "git", alone isn't going to be hooked. - you can do "cd .git". - even if you have 'autocd' option set, you can '.git' and it will do "cd .git". I'm not saying it's even a good practice, but I find it kinda cool, when using this feature in a way it's probably not intended for, you start thinking in 'what might happen inside'.
- moonchild 6y agoThis allows you to enter https://github.com/zsh-users/zsh.git Into your shell, and have it automatically get translated into git clone https://github.com/zsh-users/zsh.git It has no effect at all on your ability to run regular git commands.
- dstroot 6y agoThat is brilliant. Thanks mate.
- rgrau 6y agocheers! happy hacking :)