Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Please, make sure to create a "Pull Request" from a branch and NOT from your "master". (You'll understand exactly why after reading #2)
  2. Be warned that any additional changes/commits you make to that branch (before the "Pull Request" is accepted/merged) will immediately be included in that existing "Pull Request". This means that, if you want to continue your local development, you must create that "Pull Request" from a semi-static branch (so that any additional commits you make on "master" in the meantime don't get included as part of the existing "Pull Request").
    • The reason why this occurs is that a "Pull Request" just points at a specific "branch" (the branch it was initialized from). It does NOT point at a specific set of commits. So, when the "Pull Request" is accepted/merged, you are pulling in the latest version of that "branch". For more information, closely read the GitHub help page on Pull Requests, specifically noting the following statement:

      Pull requests can be sent from any branch or commit but it’s recommended that a topic branch be used so that follow-up commits can be pushed to update the pull request if necessary.

  3. Once your "Pull Request" is created, you can use the GitHub Pull Request tools to communicate with the Committer who is assigned to the Pull Request. If further changes are requested, you can make those changes on the branch where you initiated the Pull Request (and those changes will automatically become part of the Pull Request, as described above)

Recommended setup of repositories for commiters

As a commiter, to be able to push to the official DSpace/DSpace repository, you need to have your public ssh key added to your GitHub account. To do that, go to Account settings - SSH Keys. You can add multiple ssh keys (useful if you use multiple machines).

If you don't have a ssh key generated yet, you can generate one using:

Code Block
ssh-keygen -t dsa

The recommended setup is as follows:

  • Read/write access to the DSpace/DSpace repo. The git remote should be named "upstream" in your local clone.
  • Read/write access to your YourName/DSpace repo. This is a fork of the DSpace/DSpace repo (created by clicking the "Fork" button on GitHub). You should clone your local repo from this, therefore it will be visible as the "origin" remote in your local repo.
  • A local repo on your machine (or multiple repos if you work on multiple machines).
Code Block
# make sure you have forked the DSpace/DSpace repo on GitHub
git clone git@github.com:YourName/DSpace.git
cd DSpace
git remote add upstream git@github.com:DSpace/DSpace.git
git fetch upstream
# now "git remote show" should look like this:
origin
upstream

 

Getting a commit to multiple branches (backporting)

This will be explained on the example of getting a bugfix to both

  • to the "master" branch (in order for it to appear in the next major DSpace release)
  • to the release branch, e.g. "dspace-3_x" (in order for it to appear in the next minor DSpace release)
Option 1

Create two separate pull requests, one for the master branch, one for the release branch.

Option 2

The terminology used here will assume the setup described in "Recommended setup of repositories for commiters".

First, make sure you have the dspace-3_x branch set up correctly in your local repo.

Code Block
# run one time only, to get the branch to your local repo
git checkout --track -b dspace-3_x upstream/dspace-3_x

 

  1. Create a pull request for the master branch
  2. After it has been reviewed and approved, pull the pull request to make it appear as 2 commits in the master branch - the change itself and the merge commit. Make sure you know the hash of the original commit.
  3. Use git cherry-pick to add the commit to the release branch:
Code Block
# If you just merged to upstream/master) fetch the list of latest revisions from the upstream repo. not needed if you have the commit anywhere in the local repo.
git fetch upstream
# this is the hash of the original commit:
git cherry-pick abc123def456
# check that it's correct:
git log
# push from your local repo to the upstream repo
git push upstream dspace-3_x

 

Common DSpace Git/GitHub Issues

...