Re: merging unmanaged working tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avery Pennarun <apenwarr@xxxxxxxxx> writes:

> 2010/3/15 Łukasz Stelmach <lukasz.stelmach@xxxxxxxxxxxxx>:
>> 1. There is a repository (non-bare one) with all changes
>>   commited. Commit A.
>>
>> 2. I take some files put them on my pendrive. I take a note that they come
>>   from commit A. I don't clone the repository.
>>
>> 3. I make changes here (in the repository) and commit them (commits B,
>>   C, D) and there (on my pendrive).
>>
>> 4. I want to merge things with something like this
>
> You have a few options that I can think of.
>
> 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?

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

> c) Make a clone of your repo on the PC, then rsync the non-git parts
> of that clone's work tree to and from your pen drive.  (This option is
> the most error-prone since you have to make sure you never rsync in
> the wrong direction at the wrong time.  But it's maybe the easiest to
> understand.)

Doesn't look good. As easy to under as to mess up.

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 

Now you can make some changes to both the local and the portable copies.
You commit the only local changes. Next you retrieve the branching point
into a temporary directory

$ git archive --prefix sync-prj/ --format tar \
  $(head -1 /media/pendrive/project/HEAD | cut -f 2 -d ' ') | \
  tar -C  /tmp -xf -

# run diff3 on ./* /tmp/sync-prj/* /media/pendrive/project/*
# fix conflicts
$ git commit -a merged

The biggest drawback, at the moment, seems to be the fact that I need
some space for the branching point archive. And diff3 can't compare
directories like diff -uNr does. But in the end it seems quite robust
and might actually work with multiple hosts (as long as you can find the
commit from /media/pendrive/project/HEAD on each of them).

Thanks.

-- 
Miłego dnia,
Łukasz Stelmach

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]