Moving a Legacy Redmine Feature Branch to GitHub¶
- Table of contents
- Moving a Legacy Redmine Feature Branch to GitHub
None of the feature branches in the original LArSoft Redmine repositories on cdcvs.fnal.gov will be migrated to GitHub. In addition, the history of remaining branches will be truncated to the time of the migration from svn to git in 2014. These changes will make the GitHub repositories much cleaner than their Redmine counterparts. One side effect of this cleanup, however, is that a legacy branch that came from or has been committed directly to a Redmine repository cannot be committed to or merged with the corresponding LArSoft repository on GitHub. A feature branch created before the migration to GitHub, for example, cannot be merged back into the LArSoft repositories on GitHUb.
The following instructions describe a procedure that will alter the history of a local branch to make it consistent with that in the LArSoft repositories on GitHub. Users can use this procedure to recover legacy working branches created prior to the migration.
These instructions describe how to check-out a legacy feature branch in a local repository cloned from Redmine prior to the GitHub migration, and add it to a new fork on GitHub that then be the source of a pull request to the upstream LArSoft repository.
Important: It is necessary to use mrb v3_03_01 or later.
# Check-out the desired legacy feature branch in a local repository "package" # setup mrb source localProducts*/setup cd $MRB_SOURCE/<package> git checkout <feature branch> # # Remove the remote 'origin', which points to Redmine, and add a remote 'upstream' that points at # the appropriate LArSoft GitHub repository # git remote rm origin git remote add upstream https://github.com/LArSoft/<package>.git # # Fork the GitHub repository to your personal account. Make it the remote 'origin' # hub fork --remote-name=origin # # Download and run the "truncate-history.sh" script on that branch inside the local git repository # curl -O https://cdcvs.fnal.gov/redmine/attachments/download/55374/truncate-history.sh chmod +x truncate-history.sh ./truncate-history.sh # # Push the branch to origin in your personal GitHub account, and optionally create a pull request # to merge the branch to 'develop' # (Note that ssh access needs to be enabled for the @push@ command) # git push origin <feature branch> hub pull-request --edit --base develop
truncate-history.sh script will take between a few seconds to a few minutes, depending on the repository. This table shows the time it took to run the
truncate-history.sh script using branch
feature/Spack-MVP1a. (The table of example times is copied from Truncating_commit_history_at_svn_to_git_transition.)
What if I have more than one feature branch?¶
Check out each of the branches in the local repo before removing the Redmine origin. Run the truncate_history.sh script on each branch.
What if there is a fork already existing for your github username?¶
'hub fork' is a noop if the fork of the repo already exists in your GitHub account. If you made a fork before the final migration of larsoft repos, then these forks will be orphaned. You will need to rename/remove these orphaned repos through the Github web interface before running 'hub fork'.
Update from the primary¶
git pull upstream
Delete the orphaned fork and starting fresh¶To delete an existing old fork that is no longer relevant.
- login at github
- select your repositories
- click on the repository
- click on the repository setting, NOT the general github settings
- scroll to the bottom of the page
- There will be an option to delete the fork. Follow instructions.