Hacker News new | ask | show | jobs
by asveikau 3184 days ago
The danger of this is if you accidentally write 'git git something' into a shell script and it works on your machine, then you commit the script to a repo and it doesn't work for anyone else.

I suppose this is a problem with any alias.

2 comments

One way around that issue is to prefix commands you intend to share with backslash:

    $ \gstatus
    gstatus: command not found
vs

    $ gstatus
    git status stuff
The backslash just disables alias expansion. This works on all shells I'm aware of. It won't help with other portability concerns like actual missing commands though, of course.
I find writing shell scripts is a different mental process than interacting with the commandline, so I think the problem of “starting a command then leaving the terminal” is non-existant in that context.