Julia-git workflow, newbie questions


I’ve made a few small changes to julia/test/perf/micro to get them running on 0.7.0. I’d like to make a pull request for them, but I can’t figure out the proper git workflow from the docs.

So far I’ve followed directions from CONTRIBUTING.md

  • have forked github.com/julia to github.com/johnfgibson/julia
  • have cloned the fork to a local machine
  • switched local clone to branch perf-micro-update
  • made changes, got the benchmarks running
  • did a git add, git commit, and git push origin perf-micro-update to push the changes to my github fork

But now my github fork is 92 commits behind master, and I can’t figure out how to merge those into my work, local or github, in order to make a clean pull request.

The Patrick O’Leary Julia-Github video and accompanying notes give a beautiful explanation what to do, but directly between a local clone and github.com/julia, without the intervening fork of julia to one’s personal github account. But that fork is recommended by CONTRIBUTING.md. I don’t get the reason for the fork or how to adapt the O’Leary instructions to deal with it.


Option 1 is: do nothing at all. Your branch need not be based on the very latest master to have a clean pull request, as long as you and master have not both modified the same lines. You can just open a pull request right now, and github will tell you if it can be merged cleanly (I just checked, and your particular branch can).

But beyond that, I think you may have misread the notes you linked (or maybe the video is different?). The notes do actually specify the workflow using a github fork of julialang/julia:

After creating a fork of the julia repository under your own github account, add the repository
git remote add mine git@github.com:dmbates/julia.git

In fact, there’s really no way to submit a PR through github without making a fork first, so this is a necessary step.

But you’ve gone a bit off-script by cloning your fork, rather than cloning julialang/julia and adding your fork as a new remote (as the notes suggest). Fortunately, that’s not a problem. You (probably) currently have:

$ git remote -v   
origin	git@github.com:johnfgibson/julia.git (fetch)
origin	git@github.com:johnfgibson/julia.git (push)

You need to tell git about the upstream repo. You can create a new remote with the name upstream like this:

git remote add upstream https://github.com/julialang/julia

And then you can get the commits from upstream with:

git fetch upstream

And you can merge the upstream master changes into your work with:

git checkout perf-micro-update
git merge upstream/master

and push your changes to your fork with

git push origin perf-micro-update

Or you can rebase (if you know what this is and care about linear commit history. Don’t do this unless you have specific reason to. ):

git checkout perf-micro-update
git rebase upstream/master


Great, thanks! I see that I did go off-script in cloning from my github fork. I think I was interpolating expectations from subversion experience into the CONTRIBUTING.md instructions.