Click here to skip to this page's main content.

Internet Archive logo

Site Search

Site Search
Last edited by Ben Companjen
March 23, 2013 | History

Committing Changes

This document is intended for both developers with read/write access to the https://github.com/internetarchive/openlibrary repository and "normal" users wanting to help by sending a pull request on GitHub.

"Normal" users

If you spot a problem, or want to work on a reported issue and think you know what code needs to be changed, follow these steps. This assumes you have already set up git on your computer and created an account on GitHub. The first steps (creating a fork and downloading it to your computer) are also explained with screenshots on GitHub.

Set up your fork of the OL repository (needs to be done only once):

  1. Fork https://github.com/internetarchive/openlibrary on GitHub by clicking the Fork button
  2. You get http://github.com/{username}/openlibrary
  3. $ git clone <https://github.com/{username}/openlibrary.git>
  4. $ cd openlibrary
  5. $ git remote add olgithub <https://github.com/internetarchive/openlibrary.git> # Remote for internetarchive/openlibrary

You now have a local copy of your own fork of the Open Library repository, in a directory called openlibrary. Your fork on the GitHub servers is a remote called origin. By default, you are looking at the master branch.

To work on a specific issue with the intent of submitting a pull request, do this:

  1. $ git pull olgithub # Start from the current Open Library code
  2. $ git branch issue-name # Create a branch for the issue; choose a descriptive issue-name
  3. $ git checkout issue-name # Switch to the new branch
  4. Make some changes to file foo.py
  5. $ git add foo.py # If you changed multiple files, add all file names separated by spaces, e.g. $ git add foo.py foo2.py directory1/bar.html
  6. $ git commit -m "My commit message" # Commits to local repository. Use a descriptive commit message in imperative form, like Fix issue-name by correcting variable name x.
  7. $ git pull olgithub master # pull in changes from openlibrary/master
  8. Resolve any conflicts
  9. $ git push origin issue-name # push to your fork on github
  10. Go to
  11. Just above the file list, choose your new branch issue-name from the drop down list
  12. Click the Pull request button near the top of the page
  13. Enter a short, clear description of changes and a more detailed explanation of why these changes are needed/for the better.
  14. Submit!

Open Library developers

Proposed git workflow using github forks for people with access to the https://github.com/internetarchive/openlibrary repository:

  1. Fork https://github.com/internetarchive/openlibrary on github
  2. You get http://github.com/{username}/openlibrary
  3. $ git clone <git@github.com>:{username}/openlibrary.git
  4. $ cd openlibrary
  5. $ git remote add olgithub <git@github.com>:internetarchive/openlibrary.git # Remote for openlibrary/openlibrary
  6. $ git branch --track production olgithub/production # Tracking branch for openlibrary/openlibrary/production
  7. Make some changes to file foo.py
  8. $ git add foo.py
  9. $ git commit -m "My commit message" # commits to local repository
  10. $ git pull <git@github.com>:internetarchive/openlibrary.git master # pull in changes from openlibrary/master
  11. Resolve any conflicts
  12. $ git push # push to your github fork
  13. $ git push olgithub master:master # push local master to github openlibrary/master
  14. $ git checkout production # Checkout production tracking branch
  15. $ git merge master # Merge changes to tracking branch
  16. $ git push # Push local production branch to openlibrary production branch
  17. $ git checkout master # Switch back to your local master

History Created July 20, 2010 · 15 revisions

March 23, 2013 Edited by Ben Companjen git@github.com was auto-escaped as an email address, changed to https:// form. Added link to GitHub's forking help.
March 23, 2013 Edited by Ben Companjen Added workflow for submitting pull requests
February 27, 2013 Edited by Ben Companjen HTTPS URLs may not show up...
February 27, 2013 Edited by Ben Companjen Added <> to GitHub URL so that it shows up, escaped git commands
July 20, 2010 Created by mangtronix Notes on setting up a github fork and pushing to openlibrary master and production branches