一段时间以来,我已经拥有一个Git存储库来控制我的emacs初始化文件。今天,事情以某种方式发生了变化。即使提交数量很多,git status
仍报告:“尚无提交”,并提议跟踪“新文件” init.el
。这是不正确的。确实,跟踪的文件在那里完整无缺,.git
文件夹也在那里(大概不完整),对象在那里,而我希望在那里的文件也在那里。
我不知道发生了什么。我的直觉是遇到一个不幸的文件系统错误,该错误恰好在此存储库中获得了一些关键信息。
确实没有数据丢失的问题,因为我从备份中恢复了数据(它是本地存储库,因此没有替代克隆的方法,但是备份可以完成工作)。但是,从我对Git的了解来看,这不是我期望的。我希望事情会更加稳健。
所以,我想知道两件事。从Git的角度来看可能出了什么问题? (以下信息)。如果我没有及时进行备份,我将如何恢复这样的存储库?
关于存储库中的更改,我可以将其固定为多个文件:
这是一个同步同步屏幕截图,它从(良好)还原的存储库到我的外部HDD上的(不良)更高版本,因此“已删除”文件可能是我的备份丢失的提交。无论哪种方式,好的版本和损坏的版本仅在那些文件中有所不同,其余所有都是相同的。
更准确地说,diff -bur dot-emacs "dot-emacs (corrompido)"
给了我
diff -bur dot-emacs "dot-emacs (corrompido)"
diff -bur dot-emacs/.git/COMMIT_EDITMSG "dot-emacs (corrompido)/.git/COMMIT_EDITMSG"
--- dot-emacs/.git/COMMIT_EDITMSG 2019-02-19 19:33:23.000000000 -0300
+++ "dot-emacs (corrompido)/.git/COMMIT_EDITMSG" 2019-02-21 18:52:34.761102130 -0300
@@ -1,10 +1,8 @@
-Add make4ht intermediary files, to be cleaned
+Add LaTeX-item-regexp to safe local variables
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
-# Date: Mon Feb 18 10:10:12 2019 -0300
-#
# On branch master
# Changes to be committed:
# modified: init.el
Binary files dot-emacs/.git/index and dot-emacs (corrompido)/.git/index differ
diff -bur dot-emacs/.git/logs/HEAD "dot-emacs (corrompido)/.git/logs/HEAD"
--- dot-emacs/.git/logs/HEAD 2019-02-19 19:33:23.000000000 -0300
+++ "dot-emacs (corrompido)/.git/logs/HEAD" 2019-02-21 18:52:34.793102485 -0300
@@ -295,3 +295,4 @@
0c7b8edcde713c9792fc287c955c749769b440d8 2c5486c5c5cc6c45c0876a80ac51244dcd4f7c09 gusbrs <19410606+gusbrs@users.noreply.github.com> 1550495412 -0300 commit: Add make4ht intermediary files, to be cleaned
2c5486c5c5cc6c45c0876a80ac51244dcd4f7c09 4ef5ff4538822082e8dd65d9251379e9be964cfc gusbrs <19410606+gusbrs@users.noreply.github.com> 1550578780 -0300 commit (amend): Add make4ht intermediary files, to be cleaned
4ef5ff4538822082e8dd65d9251379e9be964cfc 3fc15187e0a6d3a12580c990b08e62e77bd24db7 gusbrs <19410606+gusbrs@users.noreply.github.com> 1550578790 -0300 commit (amend): Add make4ht intermediary files, to be cleaned
+3fc15187e0a6d3a12580c990b08e62e77bd24db7 0adb9ad30843f0cc7c48423ed0097a67c95add78 gusbrs <19410606+gusbrs@users.noreply.github.com> 1550753569 -0300 commit: Add LaTeX-item-regexp to safe local variables
diff -bur dot-emacs/.git/logs/refs/heads/master "dot-emacs (corrompido)/.git/logs/refs/heads/master"
--- dot-emacs/.git/logs/refs/heads/master 2019-02-19 19:33:23.000000000 -0300
+++ "dot-emacs (corrompido)/.git/logs/refs/heads/master" 2019-02-21 18:52:34.797102530 -0300
@@ -275,3 +275,4 @@
0c7b8edcde713c9792fc287c955c749769b440d8 2c5486c5c5cc6c45c0876a80ac51244dcd4f7c09 gusbrs <19410606+gusbrs@users.noreply.github.com> 1550495412 -0300 commit: Add make4ht intermediary files, to be cleaned
2c5486c5c5cc6c45c0876a80ac51244dcd4f7c09 4ef5ff4538822082e8dd65d9251379e9be964cfc gusbrs <19410606+gusbrs@users.noreply.github.com> 1550578780 -0300 commit (amend): Add make4ht intermediary files, to be cleaned
4ef5ff4538822082e8dd65d9251379e9be964cfc 3fc15187e0a6d3a12580c990b08e62e77bd24db7 gusbrs <19410606+gusbrs@users.noreply.github.com> 1550578790 -0300 commit (amend): Add make4ht intermediary files, to be cleaned
+3fc15187e0a6d3a12580c990b08e62e77bd24db7 0adb9ad30843f0cc7c48423ed0097a67c95add78 gusbrs <19410606+gusbrs@users.noreply.github.com> 1550753569 -0300 commit: Add LaTeX-item-regexp to safe local variables
Only in dot-emacs (corrompido)/.git/objects/0a: db9ad30843f0cc7c48423ed0097a67c95add78
Only in dot-emacs (corrompido)/.git/objects/43: b802457cc9ab2d15146fbaf5711e76d0b11f6f
Only in dot-emacs (corrompido)/.git/objects/56: 49d3b00a4c1721287df6de1b8bfde1cf909089
diff -bur dot-emacs/.git/refs/heads/master "dot-emacs (corrompido)/.git/refs/heads/master"
--- dot-emacs/.git/refs/heads/master 2019-02-19 19:33:23.000000000 -0300
+++ "dot-emacs (corrompido)/.git/refs/heads/master" 2019-02-21 18:52:34.801102573 -0300
@@ -1 +0,0 @@
-3fc15187e0a6d3a12580c990b08e62e77bd24db7
diff -bur dot-emacs/init.el "dot-emacs (corrompido)/init.el"
--- dot-emacs/init.el 2019-02-19 19:33:23.000000000 -0300
+++ "dot-emacs (corrompido)/init.el" 2019-02-21 18:52:34.813102706 -0300
@@ -105,6 +105,7 @@
(add-to-list 'safe-local-variable-values '(outline-hide-sublevels 1) t); overview
(add-to-list 'safe-local-variable-values '(eval outline-hide-body) t); contents
(add-to-list 'safe-local-variable-values '(eval outline-show-all) t); showall
+(add-to-list 'safe-local-variable-values '(LaTeX-item-regexp . "\\(bib\\)?item\\b\\|texto\\b") t)
;; Don't ask for confirmation for "confusing" commands
(put 'dired-find-alternate-file 'disabled nil)
我仍然可以使用存储库的损坏版本。
答案 0 :(得分:1)
您可以使用>.git/refs/heads/master
重现此症状,然后执行例如git status
来看看您以前看到的内容。
用
修复tail -1 .git/logs/refs/heads/master \
| cut -d' ' -f2 >.git/refs/heads/master
该文件被某种东西截断了,一个git用来保存一个活动的主分支提示ref(不活动的ref最终最终会打包到.git/packed-refs
中)。很难说是做什么的,我能想象到的最合理的错字就是要输入$project/.git/refs/heads/master
,而实际上却要输入$project>.git/refs/heads/master
。我知道看起来不太像,但是如果您不太可能发现任何错误,则可以在所有管理/安全审核都启用的情况下运行,然后如果再次发生这种情况,请遍历审核日志以找出确切的信息谁感动了什么。 (大型机有一个“系统管理工具”日志,用于记录所有数据集的访问,这是机器人磁带库存在的原因之一。)