首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在现有存储库上,git状态报告“尚未提交”

在现有存储库上,git状态报告“尚未提交”
EN

Stack Overflow用户
提问于 2019-02-22 22:48:36
回答 1查看 3.9K关注 0票数 1

我有一个Git存储库来控制我的emacs init文件已有一段时间了。今天,不知怎么的,事情变得不一样了。尽管有大量提交,git status报告说:“还没有提交”,并提供跟踪“新文件”的init.el。这是不对的。实际上,跟踪的文件是完整的,.git文件夹也在那里(大概是不完整的),对象在那里,而我期望的文件也在那里。

我不知道发生了什么。我的预感可能会出现一个不幸的文件系统错误,它碰巧在这次回购中获得了一些关键信息。

没有数据丢失的问题,因为我从备份中恢复了数据(它是一个本地存储库,所以没有克隆回替代,但是备份完成了任务)。但是,据我所读到的吉特,这不是我所期望的。我希望事情会更好。

所以,我想知道两件事。从Git的角度看会有什么问题?(下面有一些信息)。如果我没有及时进行备份,我将如何恢复这样的存储库?

至于存储库中更改的内容,我可以将其确定为多个文件:

这是一个统一的同步屏幕截图,从(好的)还原的存储库转到我的外部HDD上的(坏的)后期版本,所以“已删除的”文件可能是我的备份遗漏的提交。无论哪种方式,好的版本和损坏的版本只有在这些文件中不同,其余的都是相同的。

更准确地说,diff -bur dot-emacs "dot-emacs (corrompido)"给了我:

代码语言:javascript
复制
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)

我仍然要处理存储库的损坏版本。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-02-22 23:41:08

你可以用>.git/refs/heads/master来再现这个症状,然后做git status,看看你以前看到了什么。

代码语言:javascript
复制
tail -1 .git/logs/refs/heads/master \
| cut -d' ' -f2 >.git/refs/heads/master

这个文件被截断了,git用来保存一个活动的主分支提示参考文件(不活动的参考资料最终会被打包到.git/packed-refs中)。很难说它是怎么做的,我能想象到的最可信的错误是想输入$project/.git/refs/heads/master,然后以某种方式输入$project>.git/refs/heads/master。看起来不太可能,我知道,但无论出了什么问题,你都不太可能发现,你可以运行所有的管理/安全审计,然后如果这种情况再次发生,搜索审计日志,以确定到底是谁碰了什么。(大型机有一个记录所有数据集访问的“系统管理工具”日志,这是机器人磁带库存在的原因之一)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54836264

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档