5

Does Git support any commands that would allow me to commit directly from a local/working tree into a remote repository? The normal workflow requires a "git add", at least, to populate the object database with copies of the file contents, etc.

I understand that this is NOT the normal, expected Git workflow. But I noticed that Git already supports downloading directly from the repository, with no local repo ("git archive"), so it seems reasonable that there might be a similar uploading operation.

Alternatively, if there isn't such a command in the core Git itself, does any 3rd-party software support direct remote writes?

Ryan B. Lynch
  • 2,307
  • 3
  • 21
  • 21
  • `git archive` serves a specific purpose that has nothing to do with using remote repositories in preference to local ones. Why do you want to do this? – Marcelo Cantos Apr 25 '10 at 07:13
  • Marcelo, if I understand Git correctly, it will always copy the files the working tree, completely (albeit compressed/deduped/packed) into the object database. This limits Git's application in situations where local storage is limited, in relation to the size/compressibility/flux of the working tree. If Git could avoid the local repo, or at least the local object db, this would be less of a problem. – Ryan B. Lynch Apr 25 '10 at 15:35
  • no, and what you're asking doesn't make any sense. seriously, hard disk space is *very* cheap. A day's worth of salary can buy a 500 GB or even 1 TB disk. git repos are very small. – hasen Apr 26 '10 at 07:33
  • hasen j, the tone of your comment and answer are pretty confrontational. Look, I don't mind that you can't imagine a situation where my operating requirements are possible--that doesn't make you inferior, it just means you don't have any knowledge of my work or experience with similar stuff. If you don't have any helpful technical contributions, I'd prefer if you didn't comment at all. – Ryan B. Lynch May 07 '10 at 19:30

2 Answers2

2

As far as I know, no (not directly, see my completed answer at the end):

Here is the official Git data workflow, between a local and a remote repo:

alt text
(source: osteele.com)

As you can see, git add is related with the index, and will not yet influence your local repo.
The all set of commands are here to help enforce some publication policies:

alt text
(source: osteele.com)


The only way to directly influence a remote repo with local changes (as changes in your working directory are entirely unknown to Git) would be to:

git diff -p origin > diff_not_in_origin.patch

send the patch and see that the "origin" server has some kind of trigger in place which will git am said patch automatically.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks VonC, v. thorough explanation. If I understand 'git am' correctly, it calls 'git apply' on the back end. Based on the man pages, I believe 'git apply' can't work on a bare repo. So, it sounds like the best I can do, here, is move the index/object DB operations (and disk usage) to the remote host? – Ryan B. Lynch Apr 25 '10 at 15:47
  • @Ryan: yes, or you can move only *one* file with git bundle (http://stackoverflow.com/questions/2545765/how-can-i-email-someone-a-git-repository/2545784#2545784) and make your bare repo (http://stackoverflow.com/questions/1830701/how-do-i-check-if-a-repository-is-bare/1830712#1830712) there (with various possibility from there: http://stackoverflow.com/questions/2400043/automatically-pulling-on-remote-server-with-git-push/2400914#2400914). – VonC Apr 25 '10 at 16:01
1

I have not tried this myself, but you could try using CVS to access your git repository, using "git cvsserver". You'd still need a working copy locally, but it would only contain one copy of the project files plus some CVS metadata.