From: g2 <gerald.gutierrez@gmail.com>
To: "Väinö Järvelä" <v@pp.inet.fi>
Cc: git@vger.kernel.org
Subject: Re: How to jump between two repositories ...
Date: Tue, 4 Dec 2007 22:44:27 -0800 [thread overview]
Message-ID: <33CB0252-20C7-4AF2-AEB3-2EAC20ED830B@gmail.com> (raw)
In-Reply-To: <3DD4D3BA-67B3-4AFC-AD24-799384D54408@pp.inet.fi>
What I am gathering from this is that I can use git in two ways: 1) as
"just another svn" bare git repository, or 2) only pull and don't
push, because push causes confusion. I'd be happy to only ever use
pull, but I have one machine behind a firewall and can't pull. I can
push to a bare git repository like the svn model, but then I would
just use svn. What's the value of "push" then?
On 4-Dec-07, at 10:20 PM, Väinö Järvelä wrote:
> On Dec 5, 2007, at 07:59, g2 wrote:
>
>> 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
>>
>> 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.
>
> Did you clone a bare repository and push to it?
>
> Here is an excerpt from Git User's Manual:
> "Note that the target of a "push" is normally a bare repository. You
> can also push to a repository that has a checked-out working tree,
> but the working tree will not be updated by the push. This may lead
> to unexpected results if the branch you push to is the currently
> checked-out branch!"
>
> So to push to your work repository, you should create an
> intermediary repository between the work and home repositories. You
> can create it by running:
> $ git clone --bare /git/work/ /git/work.git/
>
> Then you clone normally from the bare repository and pushing to it
> works fine. After you have pushed your changes to the bare
> repository, you'll have to pull them to the work repository to get
> the updates, just like you would do with any public repository.
>
> Another option would be to pull from your home repository to the
> work repository, if you can access your home computer from the work
> computer.
>
> --
> Väinö
>
next prev parent reply other threads:[~2007-12-05 6:44 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
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 [this message]
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=33CB0252-20C7-4AF2-AEB3-2EAC20ED830B@gmail.com \
--to=gerald.gutierrez@gmail.com \
--cc=git@vger.kernel.org \
--cc=v@pp.inet.fi \
/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).