I am trying to commit changes with the command git commit "commit message"
to a local branch, but am getting the following message:
error: pathspec 'commit message' did not match any file(s) known to git.
The pathspec is the mechanism that git uses for limiting the scope of a git command to a subset of the repository. If you have used much git, you have likely used a pathspec whether you know it or not. For example, in the command git add README.md , the pathspec is README.md .
To fix that you can remove remote origin and link it again. After this you should be bale to switch between the branches as usual.
Changing the latest Git commit message If the message to be changed is for the latest commit to the repository, then the following commands are to be executed: git commit --amend -m "New message" git push --force repository-name branch-name.
It's git commit -m "commit message"
. You're missing the -m
flag.
If you're using Windows you need to use double quotes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With