简体   繁体   中英

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 :

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 ?

--

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...

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 )
2. Add \\Local\\SingleFolder and commit it.
3. Create a patch of that commit ( git format-patch -1 ) 4. Mail the patch to someone who has the repository downloaded(cloned)
5. Ask them to do git am --ignore-whitespace <patch-file> to whichever branch you require
6. Push it!

Et voila!

Hope this helps! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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