Issues and PRs - procedures


Table of Contents


Helpful links:


Selecting an issue:

  • Assign yourself to an issue in github from any of the issues on the project board that are in the Ready column.
  • Feel free to work alone or with another developer.
  • There is overlap between the issues especially when modifying routes and controllers.
  • Slack - collection_extensions is the primary communication channel to get help, discuss issues, coordinate overlaps, request review of a PR


Development:

  • clone latest hyrax
  • checkout branch: collections-sprint
  • create a new branch from collections-sprint branch
  • implement in your new branch


PR

  • when code and tests are ready, commit your branch
  • rebase your branch against collections-sprint
  • create a PR with base: collections-sprint branch
  • request review on slack


Rebasing

NOTE: Because master changes so frequently, I will regularly rebase the collections-sprint branch against master to make our final merge process easier.  I will send a note out to slack before doing the rebase to avoid any conflicts for PR merging process.

What does that mean for your code?

  • I will send a note when I am going to rebase.  If you are close on a PR, I can wait for it to be merged.
  • Once the rebase happens, you will need to perform the following on your branch.
    • Run the following commands substituting...
      • YOUR-BRANCH-NAME with the name of your development branch
      • "an identifying message for saving any non-committed changes for your branch" as makes sense for your changes.  The message itself is not important.  I often use a marker like "BEFORE_REBASE", which is something that is easy to spot in the listing of stashes.
      • for `git stash apply`, substitute {0} with the actual index of the stash as shown by `git stash list`
    • (Recommended) BACKUP YOUR WORK
      • Before doing a rebase, I make sure I have a copy of my work.  This is useful if there turns out to be lots of conflicts and I'm having trouble resolving them.  I have a known good state to work from.

        ### I GENERALLY MAKE A BACKUP COPY OF THE ENTIRE hyrax DIRECTORY BEFORE DOING A REBASE ###
        $ git checkout YOUR-BRANCH-NAME
        $ cp -R ../hyrax ../hyrax_BEFORE_REBASE
        
    • (Optional) Undo commits putting all changes in your Working Copy
      • If you have made multiple commits to your branch, you may want to optionally do a soft reset before stashing changes.  A soft reset will remove the commits, and keep the changes from the commits in your Working Copy.  Then when you stash, all your changes will be in the stash.  This can avoid conflicts with the rebase.  When you apply your stash, if there are any conflicts, you will see them at that time.

        NOTE: If your commit messages have meaningful details that you want to keep, use `git log` to get the commit messages and manually copy them into an editor so you can reuse them to make a commit after the rebase process is complete.

        NOTE: In the code below, the number after HEAD~ will be the number of commits you have made on your branch.  In the example below, I have made 2 commits.

        NOTE: The before and after status checks are just for you to evaluate whether the changes you expect are there.

        $ git status
        $ git reset HEAD~2
        $ git status
    • (Required) Perform rebase

      NOTE: The stash list show below may be different from what you see if you have multiple stashes saved.

      NOTE: Stashing is only required if you have uncommitted changes.  You can skip all `git stash` commands if all your changes are committed.

      $ git status
      $ git stash save "an identifying message for saving any non-committed changes for your branch"
      $ git stash list
      stash@{0}: On YOUR-BRANCH-NAME: an identifying message for saving any non-committed changes for your branch
      $ git checkout collections-sprint
      $ git pull --rebase origin collections-sprint
      $ git checkout YOUR-BRANCH-NAME
      $ git rebase collections-sprint
      $ git stash list
      stash@{0}: On YOUR-BRANCH-NAME: an identifying message for saving any non-committed changes for your branch
      $ git stash pop stash@{0}
      $ git status

      The status you see before rebasing and after should be the same.

    • (Optional) After rebasing, if you did a soft reset, you may want to commit those changes using the commit messages you manually saved in an editor.
What to do if your branch has diverged after rebase?


If after rebasing your local branch you get a message like

Your branch and 'origin/your-branch-name' have diverged,
and have 14 and 2 different commits each, respectively.

You can execute the following command to get them back in sync.

# change your-branch-name to your actual branch name
git push --force-with-lease origin your-branch-name



References: