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

Re: switching upstream tips

From
Alex Riesen <raa.lkml@gmail.com>
Date
May 13, 2009, 07:19 UTC
Message-ID
<81b0412b0905130019x114d53d1v86833217bff613bc@mail.gmail.com>
In-Reply-To
<4A0A6BD1.7050907@gmail.com>
2009/5/13 Ittay Dror <ittay.dror@gmail.com>:
Show 6 quoted lines
> I'm working on a repository in github that is forked from another
> repository. I've committed several times and pulled (merged) from the
> upstream a few times (so the committs are interleaved). The upstream
> repository is a clone of an SVN repository (in apache). The project has
> switched svn repositories (moved from incubation to top level project) and
> so created a new repository in github.
That's evil.
> * Reorder my history so that my commits are on top of the tip of the old
> upstream repository.
Look at "git rebase -i" (interactive rebase)
> * Change the upstream repository reference so it points to the new
> repository
Just edit your .git/config and re-fetch.
> * Apply my commits on top of the new upstream repository

You can try to cherry-pick your commits (git cherry-pick). Maybe rename detection will be enough to apply your changes as is. But as far as I understand, the path names in the new upstream are now all different (moved a level up?). You can save your commits in a mbox:

   git format-patch -o mbox old-upstream..your-last-commit
Edit the paths in the mbox and try to apply the result:
   git am -3 result.mbox

Or, you can use git filter-branch to modify the old history as if it was always operating on the directory structure of the new upsteam (assuming it is possible, of course). See manpage of git filter-branch, there is an example (look for "move the whole tree into a subdirectory").

Previous: Ittay DrorNext: Ittay Dror
Message 2 of 12 in “switching upstream tips”
  1. Ittay DrorMay 13, 2009
  2. Alex RiesenMay 13, 2009
  3. Ittay DrorMay 13, 2009
  4. Alex RiesenMay 13, 2009
  5. Ittay DrorMay 13, 2009
  6. Johannes SixtMay 13, 2009
  7. Ittay DrorMay 13, 2009
  8. Johannes SixtMay 13, 2009
  9. Alex RiesenMay 13, 2009
  10. Alex RiesenMay 13, 2009
  11. Ittay DrorMay 13, 2009
  12. Alex RiesenMay 13, 2009

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.