- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我不完全确定发生了什么,但出于某种原因,我的 git 存储库的 master ref 文件现在是空的。我们在 Dropbox 上托管存储库,所以也许它与此有关..但现在我无法从中提取。它是这样说的:
Your configuration specifies to merge with the ref 'master' from the remote, but no such ref was fetched.
Dropbox 保留文件的版本,因此如果我返回到“master”的先前版本,它会显示:
fatal: object 2d154f82e59a4156a5d3ea04a0617c243ae6dc3a is corrupted
fatal: The remote end hung up unexpectedly
我该如何恢复?
最佳答案
感叹。
我喜欢 Dropbox,但我绝不会推荐它来“托管”Git 存储库。它的同步对于单文件文档来说已经足够好了,但它并没有提供安全托管 Git 存储库所需的分布式/远程文件系统语义。
希望您只是在 Dropbox 上“托管”一个裸 Git 存储库。如果是这样,您应该能够将非裸(工作)存储库中的提交和引用拼凑在一起。也应该可以手动恢复您现有的存储库,但您可能最终还是需要从其他存储库复制对象,因此您最好按照以下“高级”方式进行操作(而不是“低级”并处理从其他存储库复制对象(或复制包文件并解包其中的一部分)。
首先对您的一个工作目录进行独立克隆。
git clone file://path/to/myrepo /path/to/myrepo-recovery-work
从您的其他工作存储库导入引用和对象。
# If you have network access to the other repositories:
cd /path/to/myrepo-recovery-work
git remote add other1 user@machine:path/to/other/working-repo-1
git remote add other2 ssh://user@machine/path/to/other/working-repo-2
# etc.
git fetch --all
# If you do not have network access:
cd /path/to/other/working-repo-1 && # on machine with working-repo-1
git bundle create /path/to/other1.gitbundle --all HEAD
cd /path/to/other/working-repo-2 && # on machine with working-repo-2
git bundle create /path/to/other2.gitbundle --all HEAD
# etc.
# Transfer the bundle files to the machine that has "myrepo-recovery-work"
# (Dropbox is OK to copy the bundles, they are just single files),
# then on that machine:
cd /path/to/myrepo-recovery-work
git remote add other1 /path/to/transferred/other1.gitbundle
git remote add other2 /path/to/transferred/other2.gitbundle
# etc.
git fetch --all
然后,查看新 Remote 上的所有分支,并确定哪些分支应指向重建中央存储库的哪些提交。
git log --oneline --graph --decorate --abbrev-commit --all
# In addition to looking at the history graph, you might need to examine
# the content of certain commits. Just check them out as a detached HEADs.
git branch recovered/maintenance decafbad
git branch recovered/master cafebabe
git branch recovered/development deadbeef
git branch recovered/bug-1234 8badf00d
创建恢复的分支(和标签)并将其推送到新的裸存储库。
git init --bare /path/to/new-central-bare-repo.git # or real Git hosting service!
git remote add new /path/to/new-central-bare-repo.git
git push --tags new 'refs/heads/recovered/*:refs/heads/*'
关于Git ref master 现在空了,如何恢复?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5240479/
我似乎无法让它发挥作用。我已经尝试过在线样本,但没有一个正是我需要的。基本上我希望能够显示从给定日期过去的天数。我下面的示例是 HTML 和 PHP 的组合,出于某些原因我不得不这样做。 Date
Closed. This question needs to be more focused。它当前不接受答案。 想改善这个问题吗?更新问题,使其仅关注editing this post的一个问题。
在此处搜索“线程关联”的答案,我发现人们对此很感兴趣,但没有什么理由可以节省可能获得稳定的 QueryPerformanceTimer 结果。 假设一个现代操作系统和一个现代 2-4 插槽工作站/服务
我有一个称为main-app的聚合物元素:
我有一个表,我想在每个插入时间记录每个订单的时间戳。但是,我得到的时间戳值为零。 这是我的架构: CREATE TABLE IF NOT EXISTS orders( orde
我正在使用 MongoDB Atlas 来托管数据库并使用这个无服务器函数查询数据: import { NextApiRequest, NextApiResponse } from "next"; /
苹果卸下了转义键,并用OLED触摸条替换了它。这对emacs用户具有影响,特别是对于具有数十年肌肉内存力才能克服此变化的UNIX/emacs用户而言。幸运的是,触摸栏逃生键似乎总是在您需要的时候出现,
抱歉,我对 DbGrids 还很陌生。 我是否应该使用查询的字段编辑器并以某种方式添加一个捕获 TIMEDIFF 的新字段,然后将其添加为我的 DbGrid 中的列? 或者我可以/应该跳过字段编辑器并
正如一本相当古老的书XUnit Patterns所写,NUnit 2.0不会为每个测试创建新的测试夹具,因此,如果测试正在操纵夹具的某种状态,则该夹具会被共享并且可能导致各种不良副作用。 还是一样吗?
我知道自2016年4月以来,Youtube API的默认配额限制为1M。 如果要增加它,我们需要向Google 发送请求。 我想知道我们可以要求的配额限制的最大值是多少? 最佳答案 根据Google开
这个问题不太可能对任何 future 的访客有帮助;它只与一个较小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于全世界的互联网受众。如需帮助使此问题更广泛适用,visit the
{ "size": 0, "query": { "range": { "LogTime": { "gte": "now-1d",
当我尝试从终端编译这个简单的代码时: #include int main(void) { printf("%f\n",sqrt(10)); return 0; } 使用 gcc mai
我正在尝试筛选抓取一个 html 页面,以便我可以从中提取所需的有值(value)的数据并将其放入文本文件中。到目前为止,一切进展顺利,直到我在 html 页面中遇到了这个: In inventor
这是我的 结果 MySQL 表的示例: 我想将特定用户的所有日期向前移动相同的时间间隔,以便该用户的最高日期是当前时间戳。我知道如何获取以天为单位的间隔: /* result is 823 */ SE
我有一个函数需要从主视图中的几个不同位置调用。我们称它为 updateFunction。 我这样声明: - (void)updateFunction { //updates some vari
我正在尝试找出如何以某种方式嵌套回调。 var alpha = function(callback){ var x = 5; if(x > 2){ callback()
为什么我收到RangeError:超出最大调用堆栈错误?我正在尝试解析文本以找到数学并解决它。它一直有效,直到我开始实现括号'。我试图找出错误,但就是无法弄清楚。 我的代码: var alg = {
我记得几年前,没有使用 SSL 的原因之一是它占用了大量资源,因此影响了应用程序的性能。 如今,以当前的技术,这仍然是一个需要牢记的点吗? 这个问题的出现是因为一位同事担心使用 SSL 会影响他的应用
我正在将我的数据库从 sqlserver 迁移到 mysql当我在 sqlserver 中使用 getDate() 函数时,mysql 中的替换是 Now()但是 Now() 没有返回 getDate
我是一名优秀的程序员,十分优秀!