git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to jump between two repositories ...

From
Steven Grimm <koreth@midwinter.com>
Date
Dec 5, 2007, 06:57 UTC
Message-ID
<FE46507A-74FE-4EDE-AC28-96658B944182@midwinter.com>
In-Reply-To
<33CB0252-20C7-4AF2-AEB3-2EAC20ED830B@gmail.com>
On Dec 4, 2007, at 10:44 PM, g2 wrote:
Show 6 quoted lines
> 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?

You can push. Just don't push to a checked-out branch. I do exactly what you're describing and it works fine. It looks something like this:

server% git checkout mybranch server% edit somefile.c server% git commit

laptop% git checkout mybranch
laptop% git pull
   (with a pull configuration that pulls server's mybranch into  
laptop's)
laptop% edit somefile.c
laptop% git commit
laptop% git push server mybranch:laptop/mybranch

server% git checkout mybranch server% git rebase laptop/mybranch

Presto, ready to go. The trick is to push into a branch that's different from the one that's checked out, then rebase on top of that on the remote side after the push.

Yeah, it'd be nicer if you could just push to the checked-out branch directly (and there are hooks to let you do that) but this is only slightly awkward and it's easy once you've done it a few times.

-Steve
Previous: g2Next: Väinö Järvelä
Message 9 of 10 in “How to jump between two repositories ...”
  1. g2Dec 5, 2007
  2. Shawn O. PearceDec 5, 2007
  3. J. Bruce FieldsDec 5, 2007
  4. Andreas EricssonDec 5, 2007
  5. g2Dec 5, 2007
  6. Andreas EricssonDec 5, 2007
  7. Väinö JärveläDec 5, 2007
  8. g2Dec 5, 2007
  9. Steven GrimmDec 5, 2007
  10. Väinö JärveläDec 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.