gpt4 book ai didi

I need to see new commits on remote git repo(我需要看到远程GIT回购的新提交)

转载 作者:bug小助手 更新时间:2023-10-28 13:37:19 25 4
gpt4 key购买 nike



My problem is how to see new commits on remote git repo after I made a shallow clone of the repo.This is needed for consecutive downloading this new specific commits without huge history tail

我的问题是如何在远程GIT回购上看到新的提交,在我做了一个简单的报告克隆之后。这是连续下载这个新的特定提交而没有巨大的历史尾巴所必需的


更多回答

Why not just do an occasional pull after git clone --depth n? You'll only then get the diffs from your initial shallow clone

为什么不偶尔做一次GIT克隆--深度n?只有到那时,你才会得到与最初浅克隆人的不同之处

I tried this idea and git started to download above 4 million objects

我尝试了这个想法,Git开始下载了400多万个对象

When I do pull ,got starts to download all previously counted objects(above 4 mln)

当我拉,得到开始下载所有以前计数的对象(超过4百万)

So what do you want - see new commits on a specific branch only, without downloading the entire git repo?

那么,您想要什么--只看到特定分支上的新提交,而不下载整个git repo?

Yes this is first step.And after to download this precise number of commits only

是的,这是第一步。在下载这个准确的提交数之后

优秀答案推荐

You could do a git fetch --depth=depthValue and then use git log.

您可以执行一个GIT FETCH--Depth=DepthValue,然后使用Git日志。



You could do

你能做到的



git fetch

Git获取



to get the remote refs and then

去拿远程裁判,然后



git log HEAD..remote/branch

Git日志头..远程/分支



to see the newer commits on the remote.

在遥控器上查看较新的提交。



You can use --single-branch option to limit cloning to a single branch only. This will skip downloading all the other branches, and hence your local git clone will be much smaller in size.

您可以使用--Single-BRANCH选项将克隆限制为仅限于单个分支。这将跳过下载所有其他分支,因此您的本地git克隆的大小会小得多。



git clone -b mybranch --single-branch git://domain.com/repo.git


Later, you can use these commands to list all new commits that are present on remote repo, but not on your local:

稍后,您可以使用这些命令列出远程repo上存在的所有新提交,但不能列出本地repo上的所有新提交:



git fetch
git log HEAD..remote/mybranch


And, of course, you can update your local repo as usually by pulling all the commits from remote:

当然,您可以像往常一样通过从远程获取所有提交来更新本地回购:



git pull


I had this issue recently and for me It appears that the local repository's master branch lacks a tracking branch. so all I did was

我最近遇到了这个问题,对我来说,似乎本地仓库的主分支缺少跟踪分支。所以我就


git branch -u origin/master

After this when the next issue that will be complaining about history within the origin/master - just got for the force option as I have noticed nothing hectic tends to happen.

在这之后,当下一个问题将是抱怨历史的起源/大师-刚刚得到的武力选项,因为我注意到没有什么忙碌的倾向于发生。


I hope it helps someone :)
I stay corrected

我希望这对某人有帮助:)我一直在纠正


更多回答

I also like this method but when choosing depth too little it later causes difficulties with merging due to skipping a couple of commits between say remote/master and local master.That is why I asked how to know in advance the number of new commits on remote repo since shallow clone to be able to concisely download them only

我也喜欢这种方法,但当选择的深度太少时,由于跳过了远程/主机和本地主机之间的几个提交,以后它会导致合并困难。这就是为什么我问如何提前知道远程Repo上的新提交数量,因为浅克隆只能简明地下载它们

Or git remote update. But the problem here is that running git fetch will download every remote object, which is precisely what you don't want to do in a shallow clone.

或Git远程更新。但这里的问题是,运行git fetch将下载每个远程对象,这正是您在浅层克隆中不想做的事情。

You have not understood the question.

你还没有理解这个问题。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com