emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Re: Using Git to update more than one machine (one without net


From: Bernt Hansen
Subject: [Orgmode] Re: Using Git to update more than one machine (one without network access)
Date: Wed, 25 Feb 2009 14:31:12 -0500

Paul Mead <address@hidden> writes:

> Bernt Hansen <bernt <at> norang.ca> writes:
>
>> I suggest you put bare repositories on the USB stick.
> ...
>
>
>
>>   $ git push # update any existing branches on the usb stick
>> 
>> On your work machine just clone the USB repo
>> 
>>   $ git clone /path/to/usb/org-mode.git
>> 
>> and you should be all set.
>
> Bernt, your version seems more complicated to me, but I'm keen to understand
> more so I'll try to work through the manual to get a better understanding of
> your method, thanks. At the moment I'm not at all clear what the benefits of
> using a bare repo rather than just cloning the original for instance.

The bare repo has no working directory - it's just the repository (the
.git dir basically) and you use it for moving commits and history
between your two working copies of the repository.

In effect the usb version is no different than the version you pull from
at git.org.cz - it's just another copy of the repository.


Your home machine          USB bare repo              Your work machine
-----------------          -------------              -----------------
   org                        org.git                       org

   [H] -----push------------> [U] --------fetch-----------> [W]
   [O]                        [S]                           [O]
   [M] <----fetch------------ [B] <-------push------------- [R]
   [E]                                                      [K]

you work here                                          and you work here

do stuff, commit --->----------------------------------------\
push to usb                                                  |
                                                             v
                                                       fetch usb, merge
                                                       do more stuff
                                                       commit
                                                       push to usb
                                                             |
fetch new stuff from usb <-----------------------------------/

If you push to a NON-BARE repository you'll update the repository but
not the working directory - it's not very nice to work with.  You need
to git reset --hard between push operations and if you have changes in
both places at the same time it's a mess.  It also takes more space for
the working directories which you probably never use on a USB stick.

With a bare repository you don't work on the USB stick - it's just a
medium for moving your data (commits) from your home machine to your
work machine and vice versa.  It also happens to be a great backup for
your work... if you have a fire and your work machine melts... you have
a copy on your USB stick, and on your home machine etc.

I used to sync files directly over the network between my workstation
and my laptop essentially pushing to a non-bare repository on the laptop
(and vice versa).  The setup with a non-bare repository in between works
_much_ better and is way less confusing.

For synching org-mode.git it's easy.  You home machine will have two
remote repositories defined (origin = git.or.cz) and usb (your stick).
On your master branch you

  $ git pull [origin]

to get new commits from origin and then

  $ git push usb

to update the stick with those commits.  At work you clone the stick
(once) and origin at work is the usb stick.  Then you git fetch or git
pull at work to get commits from the usb stick as needed.

HTH,
-Bernt










reply via email to

[Prev in Thread] Current Thread [Next in Thread]