而无需首先克隆该回购

而无需首先克隆该回购

本文介绍了如何在远程回购中更新文件,而无需首先克隆该回购?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将提交推送到远程git仓库,而不首先制作该仓库的本地克隆?



我有一个有效的远程URL回购,我知道文件的路径,我所要做的就是将文件的更新版本推送到主文件。理想情况下,我希望这可以与任何有效的远程回购网址一起使用,但如果它只能与基于https的git网址一起使用,它仍然会有帮助。



我是猜测这是不可能的,因为根据回答。但我希望有一个解决方法,它使用了一些较低级别的git命令。 解决方案

不可能。但是由于预期提交只需要将一个提交作为其父提交,所以可以使用所谓的浅层克隆并只提取所需分支的提示提交。这将只从遥控器中获取最少量的物体。查找 - 深度命令行选项 git clone


Is there a way to push a commit to a remote git repo, without first making a local clone of that repo?

I have a valid URL for the remote repo, I know the path of the file, and all I want to do is push an updated version of the file onto the master. Ideally I'd like this to work with any valid remote repo URL, but it would still be helpful if it worked only with https-based git URLs.

I'm guessing this is impossible, since it does not seem to be possible even to retrieve a single file without cloning in the general case, according to the answer How to "git show" on a remote repo? . But I'm hoping there's a workaround that uses some of the lower level git commands.

解决方案

Impossible. But since a prospective commit would just need to have one single commit as its parent it's possible to employ the so-called "shallow cloning" and fetch just the tip commit of the branch you need. This will bring only a minimum amount of objects from the remote. Look for the --depth command-line option of git clone.

这篇关于如何在远程回购中更新文件,而无需首先克隆该回购?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 16:45