Suppose I git clone a repository. Then edit a file A and delete a file B. How can I restore my working copy to the original status?
Something similar to svn up.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
is the command that will fully reset your working directory to what was in the most recent commit of the current branch. Be careful. All the work in your commit before you do the
resetwill be clobbered, and you’ll lose it.If you only need to reset a single file without modifying anything else,
git checkout -- fileA.txtwill revert only that file (regardless of whether it has been just edited or fully deleted).