# Help merging two repo without connection

3 messages from 2008-11-16 to 2008-11-16. Participants: Luca Siciliano Viglieri, Sverre Rabbelier, Peter Harris.
Thread: https://gitlist.dev/t/16352

## Luca Siciliano Viglieri, 2008-11-16 14:59

Subject: Help merging two repo without connection
Message-ID: <AB681AEE-D229-4F1C-8D7B-8E60E0ED8E96@web.de>
URL: https://gitlist.dev/e/AB681AEE-D229-4F1C-8D7B-8E60E0ED8E96%40web.de

```
Hi,
i'm trying to keep synched two repositories without always having a   
direct connection.
My situation is the following:
I have a project on my computer with GIT repo.
Another developer visited me and cloned my repository connecting the  
two computer (for example via  SSH).
Than i sent him for the next days patched of my changes but when he  
came and we merged i got the following tree:

                                                               /  
-------------------------------------------(my patch)--(my second  
patch)--\
                                                              /                                                                                                                      \
-- (first commit) -- (second  
commit 
)                                                                                                                        (merge 
) --
                                                               
\                                                                                                                      /
                                                               \ (my  
patch)--(my second patch)--------------------------------------------/


I don't thinks its right to have double (or more?) commits. I would  
have expected something like:


-- (first commit) -- (second commit)  -- (my patch)--(my second  
patch)  --  (merge?) --


The patches were created with git-format-patch and merged with git-am.
I know that the commits have different sha1 but how can i keep with  
patches or something similar the two repositories exactly synched?

Thanks

Luca Siciliano

```

## Sverre Rabbelier, 2008-11-16 15:06

Subject: Re: Help merging two repo without connection
Message-ID: <bd6139dc0811160706l4dfad335wc4048cd3cfca80ec@mail.gmail.com>
URL: https://gitlist.dev/e/bd6139dc0811160706l4dfad335wc4048cd3cfca80ec%40mail.gmail.com
In-Reply-To: <AB681AEE-D229-4F1C-8D7B-8E60E0ED8E96@web.de>

```
On Sun, Nov 16, 2008 at 15:59, Luca Siciliano Viglieri
<lsiciliano@web.de> wrote:
> Hi,
> i'm trying to keep synched two repositories without always having a  direct
> connection.
> My situation is the following:
> I have a project on my computer with GIT repo.
> Another developer visited me and cloned my repository connecting the two
> computer (for example via  SSH).
> Than i sent him for the next days patched of my changes but when he came and
> we merged i got the following tree:

I suspect 'git rebase' might help you out. When you apply the patches,
apply them to the branch they were based off (instead of to the most
recent master), and then rebase -that- branch (with your 'git am'-ed
patches from your other box) onto your most recent master. That way
you should be able to keep  a linear history :).

-- 
Cheers,

Sverre Rabbelier

```

## Peter Harris, 2008-11-16 15:33

Subject: Re: Help merging two repo without connection
Message-ID: <eaa105840811160733s18be2705l60806b1bf40b1743@mail.gmail.com>
URL: https://gitlist.dev/e/eaa105840811160733s18be2705l60806b1bf40b1743%40mail.gmail.com
In-Reply-To: <AB681AEE-D229-4F1C-8D7B-8E60E0ED8E96@web.de>

```
On Sun, Nov 16, 2008 at 9:59 AM, Luca Siciliano Viglieri wrote:
> Hi,
> i'm trying to keep synched two repositories without always having a  direct
> connection.
...
> I don't thinks its right to have double (or more?) commits. I would have
> expected something like:
>
>
> -- (first commit) -- (second commit)  -- (my patch)--(my second patch)  --
>  (merge?) --
>
>
> The patches were created with git-format-patch and merged with git-am.
> I know that the commits have different sha1 but how can i keep with patches
> or something similar the two repositories exactly synched?

If you use "git bundle" instead of format-patch, you will have an
unreadable binary blob instead of a human-readable patch, but the
sha1s will not change (since the commiter information will be the
same). The remote side will "git pull" the bundle file instead of "git
am"ing it.

Peter Harris

```
