Home > Software design >  How did I break git?
How did I break git?

Time:08-18

I thought I had copied the file path I wanted to check a git diff of, but accidentally had "quit()" in my clipboard instead and hastily hit return. So I accidentally ran

(base) user@MacBook-Air sage % git diff quit()
function> 
function> 

and now, nothing seems to be working in git at all. For example:

(base) user@MacBook-Air sage % git diff HEAD
git:5: command not found: quit
(base) user@MacBook-Air sage % git status
git:6: command not found: quit
(base) user@MacBook-Air sage % git diff  
git:7: command not found: quit
(base) user@MacBook-Air sage % git log
git:8: command not found: quit
(base) user@MacBook-Air sage % git branch --list
git:9: command not found: quit

Does anyone know what I did to get this? Moreover, do you know how to fix it? All my changes on this branch are committed, but not yet on the remote branch.

I tried to Google how to reset git, but that just got me results for git reset.

CodePudding user response:

It has nothing to do with git. Your shell thinks that you are starting to define a function after seing this (), and waits for the definition of the function body. And the git becomes the function name. After that when you call git, it runs the function you defined instead of real git.

  • Related