18/09/2021 Marshall Yu

Git .gitignore 不生效

删除本地缓存

git rm -r --cached .

git add .

git commit -m 'update .gitignore'

12/07/2021 Marshall Yu

Git-撤销,放弃本地修改

一,未使用 git add 缓存代码时

可以使用 git checkout -- filepathname (比如: git checkout -- readme.md  ,不要忘记中间的 “--” ,不写就成了检出分支了!!)。放弃所有的文件修改可以使用 git checkout .  命令。

此命令用来放弃掉所有还没有加入到缓存区(就是 git add 命令)的修改:内容修改与整个文件删除。但是此命令不会删除掉刚新建的文件。因为刚新建的文件还没已有加入到 git 的管理系统中。所以对于git是未知的。自己手动删除就好了。

Revert changes to modified files.

git reset --hard 

Remove all untracked files and directories.
'-f' is force, '-d' is remove directories.

git clean -fd
Continue reading