Skip to content

Instantly share code, notes, and snippets.

@dmbates
Created May 16, 2012 16:49
Show Gist options
  • Save dmbates/2712118 to your computer and use it in GitHub Desktop.
Save dmbates/2712118 to your computer and use it in GitHub Desktop.
Setting up git for creating pull requests to JuliaLang

These notes are based on Patrick O'Leary's video that he kindly created when I was wingeing about problems with git. It is best to watch the video first then go back through these notes to recall the steps.

Create a clone of the JuliaLang repository

git clone git://github.com/JuliaLang/julia.git

or

git clone git://github.com/JuliaLang/julia.git myjulia

Change directory to the newly created clone

cd julia

and check the remote status

git remote -v

After creating a fork of the julia repository under your own github account, add the repository

git remote add mine [email protected]:dmbates/julia.git

and check again

git remote -v

Check the available branches

git branch

which should be just the master branch.

To make a new patch, create a new branch

git checkout -b linalg_test

which will also switch to the new branch, as you can check with

git branch

or

git status

Now edit or add the file(s) you wish to change (in my case test/lapack.jl) then check that indeed the file has been edited.

git status

or

git diff

(This can also be accomplished within emacs by running M-x git-status in this directory.)

At this stage I prefer to operate in the *git-status* buffer to add and commit the change to the local clone. The shell version is

git add test/lapack.jl
git commit 

You can check the log at this point

git log

or, better

git lg

using the alias available at (http://www.jukie.net/bart/blog/pimping-out-git-log).

To create a pull request the change must first be pushed to the user's github repository.

git push mine HEAD

which should respond with something like

To [email protected]:dmbates/julia.git
 * [new branch]      HEAD -> linalg_test

Checking on github.com should show the newly created branch with the change. Select the branch and click the Changes button to verify this.

Before creating a pull request, ensure that your branch is up to date

git checkout master
git lg
git pull

then switch back to the modified branch, rebase it, check the log and push to mine if required.

git checkout linalg_test
git rebase master
git lg
git push mine HEAD
@pao
Copy link

pao commented May 16, 2012

This is a great summary--I'll link back to this in the video description.

@mathpup
Copy link

mathpup commented Jan 18, 2014

As a new contributor, I encountered a few issues using the instructions above. These might seem terribly obvious to some users, but they were confusing for me.

First, the instructions above only describe how to set up a user's system and how to push a change into the user's own repository. They do not explain how to create a pull request itself. To create a pull request, see https://help.github.com/articles/using-pull-requests. Also, just to clarify, a pull-request is not a concept native to Git itself. Pull requests are a mechanism provided by GitHub to notify an approver/maintainer about a change the user has pushed and would like to have added to the main project repository.

In the following command, be careful to substitute your github name for dmbates in git remote add mine [email protected]:dmbates/julia.git

The link for the enhanced git-log http://www.jukie.net/bart/blog/pimping-out-git-log times out for me me, for it seems to be available at https://gist.github.com/mathiasverraes/4505589. The process seems to work fine using plain git-log, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment