git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: g2 <gerald.gutierrez@gmail.com>, git@vger.kernel.org
Subject: Re: How to jump between two repositories ...
Date: Wed, 05 Dec 2007 09:45:26 +0100	[thread overview]
Message-ID: <47566526.9010900@op5.se> (raw)
In-Reply-To: <20071205061425.GE11098@fieldses.org>

J. Bruce Fields wrote:
> On Tue, Dec 04, 2007 at 09:59:57PM -0800, g2 wrote:
>> Hello all,
>>
>> I am currently working on some code at the office that I also want to work 
>> with at home. Seems like a good candidate for git. So I created a 
>> repository at work and did a "git clone" at home. I've run into some 
>> strange behaviour that I don't understand and would appreciate if someone 
>> can clarify for me.
>>
>> Imagine this scenario. At work:
>> git init
>> edit test.c
>> git add test.c
>> git commit
>>
>> Then at home:
>> git clone <work git url>
>> edit test.c
>> git commit -a
>> git push
> 
> You'll be much happier at this point if you ssh into work and then git
> pull from home....
> 
>> At this point, I wanted to push my changes back to my work repository so I 
>> can continue work the next day. So at home, I did a git push. I expect that 
>> my work repository has the newest material, but I find that when I do "git 
>> status" at work the next day, it tells me that my test.c is "modified" and 
>> has already staged it for commit. I need to do a "git reset" followed by 
>> "git checkout" to update my work folder to the latest stuff.
>>
>> Totally different from my expectation of the repository knowing that it is 
>> out of date and then kindly suggesting that I should do a "git update" of 
>> some sort. What piece of understanding am I missing to properly "get" what 
>> is going on here, and how am I supposed to properly work with this setup?
> 
> Git doesn't support pushing to any branch that's checked out somewhere.
> 

Yes it does. It just supports it badly. If there is a work-tree connected to
the receiving repository and that work-tree is pristine, it would be safe and
sane to write the newly pushed changes to the connected working tree.

We do all our integration fixups by pushing to repositories with work-trees,
simply because it's ridiculously inconvenient to add the infrastructure to
pull to those repos from each individual developer. In that scenario, pushing
to a checked out branch is highly useful and perfectly safe.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

  reply	other threads:[~2007-12-05  8:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-05  5:59 How to jump between two repositories g2
2007-12-05  6:11 ` Shawn O. Pearce
2007-12-05  6:14 ` J. Bruce Fields
2007-12-05  8:45   ` Andreas Ericsson [this message]
2007-12-05 15:28     ` g2
2007-12-05 16:19       ` Andreas Ericsson
2007-12-05  6:20 ` Väinö Järvelä
2007-12-05  6:44   ` g2
2007-12-05  6:57     ` Steven Grimm
2007-12-05  7:32     ` Väinö Järvelä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47566526.9010900@op5.se \
    --to=ae@op5.se \
    --cc=bfields@fieldses.org \
    --cc=gerald.gutierrez@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).