On 9 Nov 2015 19:22, "Konstantin Khomoutov" <flatw...@users.sourceforge.net>
wrote:
>
> On Mon, 09 Nov 2015 17:59:13 +0000
> phillip.l...@newcastle.ac.uk (Phillip Lord) wrote:
>
> [...]
> > I was trying something slightly evil
> > though, which breaks this. I've been using unison to sync
> >
> > ~/src/my-repo
> >
> > between machines.
> [...]
>
> But why?  If you have unison working between those machines, you most
> probably have SSH working as well, so could just use Git for pushing
> and fetching.  In most projects (even those like the Linux kernel) and
> on a fast filesystem (e.g., extN are OK) the time it takes to
> populate/update the work tree is negligible compared to the time it
> takes to transfer the history, so why not just stick to Git? ;-)
>
> In case you "kind of heard" exchanging histories between non-bare repos
> is a no-no, I can assure you that's nonsense -- while you obey certain
> simple rules.  Actually, the single rule: don't try to push to a branch
> which is checked out.  And this rule is simple to follow: if you have
> repos A and B, and you want to push branch X from A to B, and B has it
> checked out then instead fetch X from A while working with B (that is,
> reverse the operation).  If it's inconvenient, push X to a temporary
> branch while at A, and then update X from that temp branch when back at
> B, and delete it.

Just to give a quick example on this. I'm sometimes lucky and have some
time at work with my private(ish) projects (privateish, because my company
also benefits from most of them). At such times I roughly do this:

$ git clone user@home-computer:projects/whatever
$ cd whatever
$ work work
$ git commit -a
$ git push origin master:work-master

This latter line creates a work-master branch on my home computer, which
has master checked out. Then, at home, I roughly do:

$ git rebase work-master # to get my office changes; if there's only one
commit, I can do cherry-pick, too

Now if I was quick and dirty, I do a git reset or an interactive rebase to
clean up my commits and, if everything looks good, push the whole thing to
Github or such.

Best,
Gergely

>
> If you have a dedicated machine which is always available, you can just
> create a rendez-vouz bare repo there and exchange your histories
> through it -- just like you'd do with github or any other Git hosting.
>
> If you still have some doubts / have things to clear up, just ask away.
>
> --
> You received this message because you are subscribed to the Google Groups
"Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to