[racket-dev] Getting commits from other repositories

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Nov 17 00:48:06 EST 2010

Recently there was a "pull request" that someone did via github.  We
can't use github to get it, since the plt repo there is just a mirror
from our server.

But it's easy for anyone to do it through your own clone -- here's
how to do so:

1. Get a plt clone, or use your own (it's safe to do the latter, no
   need for a new clone unless you're paranoid):

     git clone pltgit:plt
     cd plt

2. Get the foreign repository's `master' branch (or any other branch)
   into a local branch:

     git fetch git://github.com/4z3/racket.git master:foo

   This pulls the `master' branch of the remote repository into a
   local `foo' branch.  (It's possible to add the remote repository as
   a known remote, but I'm skipping that since it's a one-time

3. Look at the changes as usual:

     git log master..foo
     git diff master...foo

   Note the ".." on the first, vs the "..." on the second.  If you use
   ".." in the second, you'll see all changes between the two.

   You can also see the commits and their changes with

     git log -p master..foo

   (One thing to check is that the commits are just a simple line
   against the plt repo.  If there's a bunch of merges etc, mail me
   and I'll help sorting things out.)

4a. If you're happy with the change and want to get it as-is, you can
    rebase it against the current `master':

      git checkout foo
      git rebase master

    then get the rebased changes to your `master':

      git checkout master
      git merge foo

    (This last merge will be a fast-forward.)

4b. If you *want* a merge commit (for example, when there are a bunch
    of commits), you can skip the rebasing:

      git merge foo

5. You no longer need the `foo' branch:

      git branch -d foo

6. And you can now push as usual.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.