I recently updated my computer to the newest version of MacOS Monterey. After rebooting my computer, I tried to work on my most recent project. The git command was not working in the terminal. I got the message below:

$ git add .

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

In order to fix this, I ran:

$ brew install git

This took a little while to upload, but once it did, I was back on track. Hope this helps!