我所做的如下:
agent1.sinks.c1s1.serializer = text
agent1.sinks.c1s1.serializer.appendNewline = false
现在我在目录中只有.gitignore模式文件。所有必要的文件都消失了。
正如本文How to revert a "git rm -r ."?
中所述是$ git init
$ git add .
# bunch of unwanted files were also added
$ vim .gitignore
$ git rm -rf *
$ git add .
# but the files were actually deleted from the ./ folder.
要走的路吗?
我不确定我应该运行此命令,因为到目前为止我还没有做过任何提交。
答案 0 :(得分:4)
运行git fsck --lost-found
:
$ mkdir tt
$ cd tt
$ git init
Initialized empty Git repository in ...
$ echo I am foo > foo
$ echo I am bar > bar
$ git add .
$ git rm -rf *
rm 'bar'
rm 'foo'
$ git fsck --lost-found
notice: HEAD points to an unborn branch (master)
Checking object directories: 100% (256/256), done.
notice: No default references
dangling blob 2adbcadb36527b3048a96c5bad232f6c9e762524
dangling blob bea14010b78ced155c64da9a4c2b1a6b0831335e
$ ls .git/lost-found/other/
2adbcadb36527b3048a96c5bad232f6c9e762524
bea14010b78ced155c64da9a4c2b1a6b0831335e
$ cat .git/lost-found/other/2adbcadb36527b3048a96c5bad232f6c9e762524
I am foo
文件的名称已消失,但所有内容都已恢复为基于哈希ID的名称。