Making GitHub Topic Branches

From GlueXWiki
Revision as of 14:45, 5 July 2017 by Sdobbs (Talk | contribs)

Jump to: navigation, search

Sometimes it's desirable to work on a branch split from an a point previous to the current state of a branch, while including a subset of the changes subsequent to the split point.

This page describes how to setup such a branch. As an example, a branch for working on the mcsmear program from the first reconstruction launch over the spring 2017 data is shown.

git checkout recon-2017_01-ver01-batch01                ## move to the desired parent branch
git checkout -b recon-2017_01-ver01-batch01-mcsmear     ## create the topic branch


There are a couple of ways to find which commits to move over:

  1. You can look on the GitHub webpage for useful info about your branch. For example, if you are starting from a tag, there is a link on the associated page, e.g.: https://github.com/JeffersonLab/sim-recon/releases/tag/recon-2017_01-ver01-batch01
  2. Look for changes in a particular directory, e.g.: git log $HALLD_HOME/src/programs/Simulation/mcsmear


Then you can use the command "git cherry-pick" to apply particular commits to this branch. Note that this command only works on a freshly made branch, so you must do this before making any new commits of your own.

Examples:

git cherry-pick 1c6c71bb8a4d51eb010b04b0028752754a884781   ## memory usage fixes
git cherry-pick 2777a013946205b4f89c84624239b4ed7efb35db   ## change BCAL attenuation length in mcsmear