简体   繁体   English

git-在空目录中提交单个存储库,而无需下载存储库

[英]git - commit single repository in empty directory without having downloaded repo

Is it possible to not have to download the entire repo before making a commit, ie, to commit just a single local file or local folder by itself (without already having the existing stuff in the repo in the local directory)? 是否有可能没有作出承诺,即通过自身承诺只是一个单一的本地文件或本地文件夹(没有在本地目录中已经有在回购现有的东西)之前下载整个回购?

Specifically: 特别:

I have in a local directory, only the following to commit (with all files inside the directory): 我在本地目录中, 只有以下内容要提交(目录中包含所有文件):

\\Local\\SingleFolder

The local directory only contains that single folder. 本地目录包含该单个文件夹。

The remote directory, contains lots of stuff : 远程目录,包含lots of stuff

Folder1
Folder2
file1.cpp
anotherfile.cpp
...
(etc)

I don't want to download all that stuff locally. 我不想在本地下载所有这些东西。

Can I commit just my single \\Local\\SingleFolder without having to download lots of stuff ? 我可以只提交一个\\Local\\SingleFolder而不必下载lots of stuff吗?

-- -

Reason: computer with these files is on low disk space (blame apple tiny Flash drives), and I only need to commit one folder to an existing large repo. 原因:具有这些文件的计算机磁盘空间不足(怪异的苹果微型闪存驱动器),我只需要将一个文件夹提交到现有的大型存储库即可。 I'm trying to avoid having to USB this... 我正在尝试避免必须使用USB ...

There is no way I see you can do it unless you have the repository locally somewhere (on some other machine also). 除非您将存储库放在本地某个地方(也位于其他机器上),否则我看不出您可以这样做。

What you can do: 你可以做什么:
1. Create a new folder and make it a git repo ( git init ) 1.创建一个新文件夹并使其成为git repo( git init
2. Add \\Local\\SingleFolder and commit it. 2.添加\\Local\\SingleFolder并提交。
3. Create a patch of that commit ( git format-patch -1 ) 4. Mail the patch to someone who has the repository downloaded(cloned) 3.创建该提交的补丁( git format-patch -1 )4.将补丁邮寄给已下载(克隆)存储库的人
5. Ask them to do git am --ignore-whitespace <patch-file> to whichever branch you require 5.要求他们对所需的任何分支执行git am --ignore-whitespace <patch-file>
6. Push it! 6.推!

Et voila! 瞧!

Hope this helps! 希望这可以帮助! :) :)

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

相关问题 检查目录是否为 git 存储库(无需 cd 进入) - Check if directory is git repository (without having to cd into it) 在不首先克隆 git 回购的情况下进行空提交+推送 - Making an empty commit+push without cloning the git repo first 将现有目录链接到现有 Git 存储库,无需本地初始提交 - Link an existing directory to an existing Git repository without local initial commit 如何将目录提交到 git 存储库中? - How to commit a directory into a git repository? 从git repo克隆并提交到新的存储库 - clone from a git repo and commit to a new repository 在git存储库中处理项目(文件夹)而无需克隆整个存储库? GIT - Working on a project (folder) in a git repository without having to clone the entire repo? GIT git-svn:将现有git存储库的全部历史记录提交到一个空的Subversion子目录中 - git-svn: commit whole history of an existing git repository into an empty Subversion sub-directory 将文件从 web 应用程序(弹簧启动)提交到 git 远程存储库,而不首先将存储库克隆为本地? 这可能吗 - commit file from a web application (spring boot) into git remote repository without first cloning the repo as local? is this possible 无需提交即可还原git repo中的文件 - Restore files in git repo without commit 从git repo恢复文件而无需提交 - Restore file from git repo without commit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM