Re: Redirect git subcommand to itself?
Junio C Hamano gits...@pobox.com writes: * You can help yourself with something like this, I suppose: [alias] git = !sh -c 'exec git \$@\' - but I personally feel that it is too ugly to live as part of our official suggestion, so please do not send a patch to add it as a built-in alias ;-). So I thought I was clever, but this didn't work: % ln -s /usr/bin/git ~/bin/git-git % git git fatal: cannot handle git as a builtin -- Christian Neukirchen chneukirc...@gmail.com http://chneukirchen.org -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Redirect git subcommand to itself?
At 10:38 +0200 29 May 2015, Christian Neukirchen chneukirc...@gmail.com wrote: Junio C Hamano gits...@pobox.com writes: * You can help yourself with something like this, I suppose: [alias] git = !sh -c 'exec git \$@\' - but I personally feel that it is too ugly to live as part of our official suggestion, so please do not send a patch to add it as a built-in alias ;-). So I thought I was clever, but this didn't work: I've done the same as the original poster a few times myself, so awhile ago I added the following to my .gitconfig file: [alias] git = !f() { git $@; }; f And this has worked for me. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Redirect git subcommand to itself?
Junio C Hamano gits...@pobox.com writes: Christian Neukirchen chneukirc...@gmail.com writes: Junio C Hamano gits...@pobox.com writes: * You can help yourself with something like this, I suppose: [alias] git = !sh -c 'exec git \$@\' - but I personally feel that it is too ugly to live as part of our official suggestion, so please do not send a patch to add it as a built-in alias ;-). So I thought I was clever, but this didn't work: % ln -s /usr/bin/git ~/bin/git-git % git git fatal: cannot handle git as a builtin Why did you have to do that when I already gave an alias that works? I was just toying around, and it would have been cute. Or didn't the alias work? It does. This seems to work just as well, and is easier: git = !git Thanks, -- Christian Neukirchen chneukirc...@gmail.com http://chneukirchen.org -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Redirect git subcommand to itself?
Thanks a lot for the discussion! So I'll just fix it locally for me and we keep the state as is. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Redirect git subcommand to itself?
Christian Neukirchen chneukirc...@gmail.com writes: I was just toying around, and it would have been cute. Or didn't the alias work? It does. This seems to work just as well, and is easier: Thanks; I was wondering if I gave something that was not portable or something. git = !git I'd call that the ultimate cuteness. We have a winner ;-) ;-) ;-). -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Redirect git subcommand to itself?
Christian Neukirchen chneukirc...@gmail.com writes: Junio C Hamano gits...@pobox.com writes: * You can help yourself with something like this, I suppose: [alias] git = !sh -c 'exec git \$@\' - but I personally feel that it is too ugly to live as part of our official suggestion, so please do not send a patch to add it as a built-in alias ;-). So I thought I was clever, but this didn't work: % ln -s /usr/bin/git ~/bin/git-git % git git fatal: cannot handle git as a builtin Why did you have to do that when I already gave an alias that works? Or didn't the alias work? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Redirect git subcommand to itself?
On Wed, 27 May 2015 17:28:34 -0700 Stefan Beller sbel...@google.com wrote: so I just run into this problem again (which happens to me maybe twice a week): I want to do a git operations, so I type git into my shell, [...] then I copy the whole operation git revert --abort in this case and paste it to the shell and let go. The result looks like $ git git revert --abort git: 'git' is not a git command. See 'git --help'. [...] I wonder if we want to make a git subcommand, which behaves exactly the same as git itself? Then git git git status would just return the same as git status. In your ~/.whateverrc, put this: git() { while [ $# -gt 0 ]; do test $1 != git break; shift; done; command git $@; } This assumes a POSIX-compatible shell but I think you've got the idea. (command is a builtin which forces interpreting the following word as the name of an external program.) -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Redirect git subcommand to itself?
Stefan Beller sbel...@google.com writes: so I just run into this problem again (which happens to me maybe twice a week): I want to do a git operations, so I type git into my shell, and then [...] I copy the whole operation git revert --abort in this case and paste it to the shell On my side, that wouldn't be twice a week, but I often do the same mistake. I find your idea for a solution conceptually ugly but practically very convenient ;-), so I'd be in favor of doing it. -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Redirect git subcommand to itself?
Hi, so I just run into this problem again (which happens to me maybe twice a week): I want to do a git operations, so I type git into my shell, and then I look around what exactly I want to do and usually I find it in the help text of a previous command such as You are currently reverting commit 383c14b. (fix conflicts and run git revert --continue) (use git revert --abort to cancel the revert operation) then I copy the whole operation git revert --abort in this case and paste it to the shell and let go. The result looks like $ git git revert --abort git: 'git' is not a git command. See 'git --help'. Did you mean this? init I wonder if we want to make a git subcommand, which behaves exactly the same as git itself? Then git git git status would just return the same as git status. Thanks, Stefan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Redirect git subcommand to itself?
Stefan Beller sbel...@google.com writes: so I just run into this problem again (which happens to me maybe twice a week): I want to do a git operations, so I type git into my shell, and then I look around what exactly I want to do and usually I find it in the help text of a previous command such as You are currently reverting commit 383c14b. (fix conflicts and run git revert --continue) (use git revert --abort to cancel the revert operation) then I copy the whole operation git revert --abort in this case and paste it to the shell and let go. The result looks like $ git git revert --abort git: 'git' is not a git command. See 'git --help'. Did you mean this? init I wonder if we want to make a git subcommand, which behaves exactly the same as git itself? Then git git git status would just return the same as git status. A few unrelated thoughts. * Perhaps we should omit 'git' from these advice-texts? E.g. use revert --abort to cancel I dunno. * While we bend over backwards to a certain degree to be helpful, I somehow feel making git git a synonym to git is going too far, akin to asking POSIX maintainers to define act, cta, atc, tca, and tac all as synonyms to cat because you often fat-finger when typing cat (yes, tac does something else that is more useful, I know). * You can help yourself with something like this, I suppose: [alias] git = !sh -c 'exec git \$@\' - but I personally feel that it is too ugly to live as part of our official suggestion, so please do not send a patch to add it as a built-in alias ;-). -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Redirect git subcommand to itself?
On Wed, May 27, 2015 at 06:53:26PM -0700, Junio C Hamano wrote: I wonder if we want to make a git subcommand, which behaves exactly the same as git itself? Then git git git status would just return the same as git status. A few unrelated thoughts. * Perhaps we should omit 'git' from these advice-texts? E.g. use revert --abort to cancel I dunno. Please don't. You help the set of people who type git and then paste the rest of the command at the expense of people who just paste the whole command. We don't know the relative numbers of those people, but we know there is at least 1 in each group. ;) -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html