This problem occurs due to Xcode command-line tools are not updated.
For updating Xcode command-line tools
Goto terminal and use the following command:
Then it shows
xcode-select: note: install requested for command line developer tools
And opens a window to update Xcode command-line tools.
After the update is completed, open a new terminal window and your development tools should be returned.
After the update you need to restart your terminal to apply the updates then the function works properly.
For more information regarding git commands, like git status, git clone, git merge, etc. please go through this tutorial.