Skip to content
tjmb edited this page Apr 9, 2013 · 7 revisions

This page is for committers on the main eprints/eprints core.

Checking out using Git

You will need to create an ssh key on every system you want to push changes to github from:

ssh-keygen

Copy the contents ~/.ssh/id_rsa.pub and add it as a new key in Github by going to your account settings (top right) -> Edit Your Profile -> SSH Keys. To "check out" from git use the clone command:

git clone [email protected]:eprints/eprints.git eprints

Committing trivial fixes

Check you are in the "master" branch (it is starred):

git branch

If not,

git checkout master

Check you have the latest version by pulling any other changes from the remote master:

git pull

Make your changes, then stage the files that you touched with "add":

git add path/to/changed/file

Commit the changes to your local clone by using commit:

git commit

The commit log for git is in two parts. The 60-character title is a summary that will be shown when viewing logs. The remaining text should give the details of your changes.

Use push to share your commits with the remote repository (github):

git push

This is the simplest process for making, committing and uploading changes to github. Git provides lots of tools for merging commits together, partial change commits (parts of individual files), rolling back etc.

Merging change to 3.3 branch

git checkout 3.3
git cherry-pick <UUID>
git push
git checkout master # go back to master branch

How do I create a pull request (non-trivial change requiring review)?

You must have git 1.7+ and a checkout of the master branch.

Create a new branch to do your work in, where [branchid] is a meaningful ([A-Z0-9]) name for the feature work/fix:

git checkout -b [branchid]

Make your changes then commit them to the branch:

git add /path/to/changed/files
git commit

Push your local branch to the github repository:

git push -u origin [branchid]

Now go to the github Web UI for eprints/eprints and you will be presented with an option to create a 'pull' request from your new branch.

You will probably want to switch back to the master branch:

git checkout master

And pull any new changes:

git pull

Deleting a local branch (careful!):

git branch -d [branchid]

Deleting a branch from the github repository (careful!):

git push origin --delete [branchid]