git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avery Pennarun <apenwarr@gmail.com>
To: "Łukasz Stelmach" <lukasz.stelmach@iem.pw.edu.pl>
Cc: git@vger.kernel.org
Subject: Re: merging unmanaged working tree
Date: Mon, 15 Mar 2010 19:49:10 -0400	[thread overview]
Message-ID: <32541b131003151649v1a1265f1ke3ccac9cc930f9c8@mail.gmail.com> (raw)
In-Reply-To: <87eijlw4cn.fsf@kotik.lan>

2010/3/15 Łukasz Stelmach <lukasz.stelmach@iem.pw.edu.pl>:
> Avery Pennarun <apenwarr@gmail.com> writes:
>> a) Look at 'git clone --depth' so you can clone only the most recent
>> version of the files, not the *entire* repo.  This lets you do commits
>> on any computer you want with the pen drive plugged in, but saves
>> space.
>
> I've tried this one. It works (but why the --depht 1 gives two
> revisions?) but even thoug the main repository and the portable one have
> common commits I can't pull changes back from the mobile to the main
> one. Is there any wise trick to make git try a little harder?

I don't know; I haven't used shallow clones (ie. --depth) very much.
git's implementation of them seems a bit half-hearted.  The man page
says "A shallow repository has a number of limitations (you cannot
clone or fetch from it, nor push from nor into it), but is adequate if
you are only interested in the recent history of a large project with
a long history, and would want to send in fixes as patches."  There is
no technical reason for this limitation, as far as I know.

It does give a hint as to what you could do instead of push/pulling,
however: you could use git format-patch to extract the changes from
your shallow copy, and git am to import the patches back into your
main copy.  Seems like a pain though.

>> b) Keep your .git directory on your main PC's disk, and the working
>> tree on your pen drive.  Look at the GIT_DIR environment variable in
>> 'man git'.  Then when you bring the pen drive back to your PC, you
>> have the full repo available.  (If you use 'git clone --reference'
>> when making the new repo, the extra .git directory should take only
>> minimal space.)
>
> This one's nice and seems to be most space efficient as far as flash
> space is concerned. However, I'd be able to sync only with the machine
> that holds the portable GIT_DIR while the previous method, if only
> there was a way to make git work with shallow clones, could work with
> different hosts if I synec my No1 desktop with them too.

Maybe you could do something like:

      git clone -s ~/myrepo /pendrive/myrepo

This will give you a .git dir in /pendrive/myrepo, but all the
*objects* in the git repo will actually be borrowed from ~/myrepo.
This will make git virtually unusable on /pendrive/myrepo *unless* you
mount the disk on a PC that has ~/myrepo in the original location.  On
any such computer, you could be able to do normal git operations in
/pendrive/myrepo, including pulling changes from there to ~/myrepo.

As you do git operations on /pendrive, /pendrive/myrepo/.git will
slowly accumulate objects that you might have to clear out over time
(ie. after pushing them to the parent repo).

> I've just invented yet another method. Push the content to the pendrive:
>
> $ git commit -am branching
> $ git archive --format tar HEAD | tar -C /media/pendrive/project -xf -
> $ git log -1 > /media/pendrive/project/HEAD # to remember
> [...]

Yeah, I guess you could do that, but at that point you're basically
not using git anymore.

Have fun,

Avery

  reply	other threads:[~2010-03-15 23:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-15 11:34 merging unmanaged working tree Łukasz Stelmach
2010-03-15 12:34 ` Daniel
2010-03-15 15:19   ` Łukasz Stelmach
2010-03-15 19:22     ` Avery Pennarun
2010-03-15 23:30       ` Łukasz Stelmach
2010-03-15 23:49         ` Avery Pennarun [this message]
2010-03-15 19:58     ` Chris Packham
2010-03-15 20:01       ` Avery Pennarun
2010-03-15 23:28       ` Łukasz Stelmach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32541b131003151649v1a1265f1ke3ccac9cc930f9c8@mail.gmail.com \
    --to=apenwarr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=lukasz.stelmach@iem.pw.edu.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).