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

Re: Question on multi-level git repository heiarchy.

From
APAndy Parkins <andyparkins@gmail.com>
Date
Oct 27, 2006, 15:31 UTC
Message-ID
<200610271631.49803.andyparkins@gmail.com>
In-Reply-To
<4542120E.1050903@candelatech.com>
On Friday 2006 October 27 15:05, Ben Greear wrote:
> I want to synchronize the entire git repo, including all branches.  How
> would I go
> about doing that?

That happens anyway. "git pull" is actually a fetch + a merge. Personally I recommend never doing a "git pull" without arguments. Instead:

First, update every "Pull:" line from .git/remotes/origin
 $ git fetch
Now manually merge one of the (now locally stored) upstream trees into your 
working tree.
 $ git pull . upstream-tree
> Is there any way to recover my currently mangled tree on the
> workstation, or do I need
> to start fresh there?  If I start fresh, do I re-clone, or is there some
> better way to get

I'm relatively new to git; my experience is that there is very little that can't be undone. Exactly what sort of mangling has happened to your tree?

If you've got yourself in a real state, I suggest editing .git/remotes/origin to pull the upstream trees to some newly named branches (maybe just add "new/" to the front of them). Treat those as read-only (i.e. don't check them out), and start comparing branches. "gitk --all" is incredibly useful for this.

Make yourself a new branch for your own work based off a new/upstream branch (git checkout -b fixthings new/upstream), then use git-cherry-pick to pull your patches out of your mangled tree to build up a branch with your changes on it.

Now, you can delete all the branches that you think are mangled and (if you really want to), rename all the new/ refs back to whatever they started as.

> the synchronization that I want?

I am going to guess that you've fallen for the same thing I did at first: confusing "git pull" with "git fetch"; "git pull" can get you in trouble, "git fetch" probably won't.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE
Previous: Ben GreearNext: Ben Greear
Message 4 of 5 in “Question on multi-level git repository heiarchy.”
  1. Ben GreearOct 27, 2006
  2. Shawn PearceOct 27, 2006
  3. Ben GreearOct 27, 2006
  4. Andy ParkinsOct 27, 2006
  5. Ben GreearNov 16, 2006

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.