Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How did I break git?

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading