博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git clean reset checkout
阅读量:4284 次
发布时间:2019-05-27

本文共 866 字,大约阅读时间需要 2 分钟。

轉載自

 

To reset a specific file to the last-committed state (to discard uncommitted changes in a specific file):

git checkout thefiletoreset.txt

This is mentioned in the git status output:

(use "git checkout -- 
..." to discard changes in working directory)

To reset the entire repository to the last committed state:

git reset --hard

To remove untracked files, I usually just delete all files in the working copy (but not the .git/ folder!), then do git reset --hard which leaves it with only committed files.

A better way is to use git clean:

git clean -d -x -f

will remove untracked files, including directories (-d) and files ignored by git (-x). Replace the -fargument with -n to perform a dry-run or -i for interactive mode and it will tell you what will be removed.

Relevant links:

  •  (as Marko posted)
  • Stackoverflow question 

參考這篇的下面 ,有Git reset 取消上一次的操作說明

 

转载地址:http://qmsgi.baihongyu.com/

你可能感兴趣的文章