Reputation: 89
I typed on the command line $sudo service postgresql restart
before working on my branch and when I made a commit git saved it as a new file called "udo service postgresql restart". This file doesn't have a path, it's the same command I typed.
So I tried :
git reset HEAD udo service postgresql restart
And tried:
git rm udo service postgresql restart
Got this error:
fatal: pathspec 'udo' did not match any files
Also tried:
git checkout sudo service postgresql restart
got this error:
error: pathspec 'service' did not match any file(s) known to git.
error: pathspec 'postgresql' did not match any file(s) known to git.
error: pathspec 'restart' did not match any file(s) known to git.```
Upvotes: 0
Views: 3626
Reputation: 142164
Few options:
If this file was not committed and not part of your project, simply delete it.
If you have a file name with spaces you need to wrap the name with "
(double quotes)
If this file was added to the staging area and you wish to remove it:
git rm --cached "udo service postgresql restart"
git restore
If you are using the latest version of git (>2.25) you can use the git restore
command
Upvotes: 1