On Mon, 9 Nov 2015 22:11:04 +0100
Gergely Polonkai <gerg...@polonkai.eu> wrote:

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

99% the same of what I do in the similar situations.
The remaining 1% is that I'm not afraid to push to a branch with as
dumb a name as "temp" :-)

By the way for those with high aesthetic demands, it's perfectly OK
to use forward slashes in branch names. ;-)
So one could as well "namespace" their branches using '/', like in

    git push origin master:work/master

It works no different from your example but the resulting branch name
looks subjectively nicer in the `git branch -a` output.
AFAIK, this approach is used by the Git maintainer: he prefixes the
branches it pulls from various people into his integration repo with
the initials of the full names of those people -- so that when he pulls
a branch "foo" from Joe Random Hacker, it lands in his repo being named

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