简体   繁体   English

git fetch-缺少提交

[英]git fetch - missing commits

I am running etckeeper on two different machines, boxA and boxB . 我正在etckeeper在两台不同的机器, boxAboxB The OS, etckeeper repository and all, on boxB was copied from boxA back in January. 在一boxB ,从boxA复制了boxA上的OS, etckeeper存储库以及所有内容。 In order to apply some setup changes made on boxA to boxB , I added the repository on boxA as a remote repository on boxB with the intention of doing some cherry picking, eg: 为了应用上取得了一定的设置更改boxAboxB ,我加入了资源库上boxA作为远程仓库boxB与做一些采摘樱桃,例如意向:

git remote add boxA ssh://boxA/etc
git fetch boxA
git cherry-pick xxxx  # never got this far

The problem is that the most recent commits are not available on boxA , only commits up until late February. 问题在于boxA上没有最新提交,仅直到2月下旬才提交。 So far I have tried: 到目前为止,我已经尝试过:

  • doing git show with one of the missing commit numbers - this is definitely not a problem with git log just not showing all the commits. 用丢失的提交编号之一进行git show - git log只是不显示所有提交绝对不是问题。

  • copying the full /etc on boxA to boxB and adding/fetching it via its path - this is definitely not an issue somehow introduced by ssh (to complicate things I was using a script via the GIT_SSH environment variable to avoid creating a root login). boxA上的完整/etc复制到boxB并通过其路径添加/获取-绝对不是ssh引入的问题(为了使我正在使用通过GIT_SSH环境变量使用脚本的事情复杂化,以避免创建root登录)。

  • git fsck on both repositories (no problems found). 两个存储库上的git fsck (未发现问题)。

  • running the following command on copied version of both repositories (after doing a git remote remove boxA on boxB and before readding): 在两个存储库的复制版本上运行以下命令(在git remote remove boxA上对boxB git remote remove boxA boxB并在读取之前):

     git -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 \\ -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneExpire=now gc \\ --aggressive 

How can I get git fetch to retrieve all of the commits? 如何获取git fetch来检索所有提交?

So the problem here turned out to be that there was a detached head in the repository on boxA after an incomplete fix of a botched rebase. 因此,这里的问题原来是在对boxA库进行不完全修复之后, boxA上的存储库中有一个分离的头部 When this happens the output of git branch is as follows: 发生这种情况时, git branch的输出如下:

# git branch
* (no branch)
  master

The fix was simply to create a branch on boxA and then merge it: 解决方法只是在boxA上创建一个分支,然后将其合并:

git branch temp
git checkout master
git merge temp
git branch -d temp

After that all the commits on branch master (or at least what I thought was branch master) were available after doing another git fetch . 之后,在执行另一个git fetch之后,就可以使用分支母版上的所有提交(或者至少我认为是分支母版)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM