0

I am using tortoise git to operate our git repository on my local machine. However, when I am logged in on a linux machine (ssh) somewhere else, I have to operate git on console.

Locally I use often git tortoise to revert single files to the last commit. What is the corresponding command on console? git revert >commit< reverts the whole repo batch. git revert >file< does not work.

1 Answer 1

1
git checkout <commit> -- <files...>

If you want to revert to latest commited version, you can omit <commit> part.

For example:

git checkout master -- README.md
git checkout master -- package.json package-lock.json

Note that unlike regular revert, this won't commit reverted files immediately.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .