简体   繁体   中英

Hg update -C mercurial command equivalent in git

Suppose I have made changes to several files in a git repository that was for exploratory purposes and now I want to undo all of my changes back to the original state.

If this was mercurial I would simply do

hg up -C

What is the proper way to acheive this in git?

If you just wish to discard changes for just one file you can type:

git checkout -- <file>

(actually "git status" is giving you this hint).

If you want to throw away all local changes:

git checkout -f

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM