6

How do I and/or is it possible to update (pull/rebase/reset --hard branchname) a fork of a project on github ON THE WEBSITE .. WITHOUT GIT

Here's the specific problem. I just pulled the upstream changes to my local machine over a very slow internet connection (400meg of changes). It took a long time. I'd like to now start making changes locally and then upload my changes to my fork on github. The problem is, when I go to push to github git is going to upload those 400mb of changes to my fork. If I could go to github.com and tell the fork there to update from the place it forked then those 400meg would get transferred on github and when I finally went to push my local changes there'd only be a few k difference to upload.

A diagram. This is the normal way to do this

github:upstream               github:origin
        \                          ↗
         \                        /
          \                      /
           ↘                    /
  (git pull 400meg slow)     (git push 400meg+1k slow)
                 \            ↗
                  \          /
                   \        /
                    ↘      /
                      local

This is what I want

github:upstream ----> (pull fast) ->  github:origin
        \                               ↗
         \                             /
          \                           /
           ↘                         /
  (git pull 400meg slow)       (git push 1k fast)
                 \               ↗
                  \             /
                   \           /
                    \         /
                     ↘       /
                       local
gman
  • 100,619
  • 31
  • 269
  • 393

2 Answers2

5

These steps seem to work (please check the last step).

  1. Go to your fork on github and on the right click "Pull Request"

  2. Click "New Pull Request"

  3. You should see a message "There isn't anything to compare". Click "try switching the base for your comparison".

    This will switch the pull from forkedrepo:master ... fork:master to fork:master ... forked:master.

  4. Type a description like "Merge" and click "Send Pull Request"

  5. You'll now see a pull request going from the forked repo into your fork. Scroll to the bottom. You should see "This pull request can be automatically merged". Click "Merge Pull Request"

  6. Click "Confirm Merge"

At this point you should have all the new changes in your github repo. In order to get rid of the superfluous merge commit these steps seem to work (or maybe I'm missing something?)

Locally,

$ git pull origin master
$ git reset --hard HEAD~1 
$ git push origin master -f

note: I found this technique here.

gman
  • 100,619
  • 31
  • 269
  • 393
  • Seem a very good use of pull requests, much easier than my "delete/recreate fork" technique. +1 – VonC Mar 11 '14 at 11:23
  • Merging the pull requests creates another "commit" and makes the forked repository ahead of the original one. – A.Jesin Aug 04 '14 at 18:16
1

One solution would be to create a new fork from the current state of the upstream repo.

That operation is done in GitHub side, and you would push to that new fork.

You could even work with two forks, deleting and recreating one as needed, while keeping the other.

The only issue is that it would mess with in progress pull requests you would do from those forks to upstream.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Yea, I thought about that one. Unfortunately I have other branches on github on my fork so forking again would get pretty painful pretty quickly. – gman Mar 11 '14 at 07:16
  • 1
    @gman then the idea of two forks make even more sense. One you delete/recreate on demand to push the small delta to it. One to manage your branches. – VonC Mar 11 '14 at 08:40