Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I did this (was trying to set an 'self' alias with -v):

 git() { if [[ $1 == "commit" ]]; then command git commit -v; else command git "$@"; fi; }
  git() { if [[ $1 == "commit" ]]; then command git commit -v; else command git "$@"; fi; }
  git() { git commit }; )
  git() { git commit; }
  git() { git (); }
  git() { git(); }
  git() { git() }

and now all git commmands hang - no error but no return prompt.

I've uninstalled and installed git but it hasn't helped.

How can I reset git command back to the default?

I've tried mv .gitconfig .gitconfig_old but it didn't help.

share|improve this question
So do you or do you not have a problem with git? If you ran git() { git(); }, then you defined git as a function that does nothing but call itself. Undefine it (unset -f git) or redefine it to something sensible first. – Gilles Sep 24 '12 at 0:21
up vote 3 down vote accepted

You sound really confused.

All those function definitions you ran were in the shell. If you ran them directly from the command line, then they only affect the current running shell environment. So if you had just closed the terminal and started a new one, the definitions would have been lost, and everything would be back to normal. Or you could have unset the definition with unset -f, as described in the comment.

This is why re-installing git has no bearing on your problem.

Renaming your .gitconfig won't make any difference either. You didn't make the changes in your .gitconfig, so why would it?

If you had followed the advice in your previous question, and set up an alias using git's aliasing method instead, then moving your .gitconfig would indeed have had an effect, and would have effectively removed your alias (along with all the rest of your configuration).

Incidently, all this confusion with the base command being overridden is the main reason git doesn't allow this type of name remapping under its own aliasing system. To quote the git-config manpage:

"To avoid confusion and troubles with script usage, aliases that hide existing git commands are ignored."

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.