Open-Development Techniques PAHFIT HackDay 11 Jan 2021 Karl D. Gordon Astronomer at STScI [email protected] @karllark2000 karllark@github “Have Dust – Will Study” Image source: https://github.blog/2015-07-29-git-2-5-including-multiple-worktrees-and-triangular-workflows/
Astropy Affiliated Package ● http://docs.astropy.org/en/stable/development/af filiated-packages.html ● Take advantage of the community knowledge of how to do distributed/social code development
Github ● Social coding ● Provides an easy to use user interface to git – Git = version control for tracking changes ● Manage development via issues ● Fork-Clone-Pull model
Issues ● Centralized location for code management ● Allows for anyone anywhere to keep up-to-date ● Anyone can raise an issue ● Anyone can comment on an issue ● All work should be tracked via an issue – Avoids multiple people working on the same thing ● Issues assigned to specific people – Others can contact and coordinate
Fork-Clone-Pull Model ● Everyone forks the master repository ● When updated code/docs/etc ready, issue a pull request to master repository – Identify the issue(s) this pull request addresses ● Review and discussion of pull request ● Pull request approved → code merged
Work needed - Issues ● All work this week needs an issue – Gets us into the habit – Central organization – Allows remote participation – Keeps track of work ● Major Areas – Code, cleanup and enhancements – Documentation, more and setup with readthedocs – Testing, more and setup with travis – Build, setup and test – Logo?
How to Fork ● https://help.github.com/articles/fork-a-repo/ ● On github, got to the master PAHFIT repository – Find the fork button – Makes a copy of the repository in your github area
Clone the fork to your computer (& setup sync to master) ● In your github area, find the code button ● On command line in the directory you want the copy – git clone [email protected]:YOURGITNAME/pahfit.git ● Configure your clone version to sync with master BEAST version – In the github master BEAST respository – Find the clone button – Goto the directory with your clone version – git remote add upstream [email protected]:PAHFIT/pahfit.git
Clone the fork to your computer (& setup sync to master) ● In your github area, find the code button ● On command line in the directory you want the copy – git clone [email protected]:YOURGITNAME/pahfit.git ● Configure your clone version to sync with master PAHFIT version – In the github master PAHFIT respository – Find the clone button – Goto the directory with your clone version – git remote add upstream [email protected]:PAHFIT/pahfit.git
Syncing your fork ● https://help.github.com/articles/syncing-a-fork/ ● Get updated files from the pahfit master – Do this when when appropriate (e.g., starting new branch) ● In directory of clone on your computer – git fetch upstream – git checkout master – git merge upstream/master ● If you only update your master this way, life will be easier
Branch your fork ● https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-bra nch-with-git-and-manage-branches ● Branches make it easy to manage work – Can have multiple branches and switch between them – New branch for a new issue ● In directory of clone on your computer – git checkout -b new_branch_name – git push origin branch_name → send to github – git branch → show branches on computer – git checkout branch_name → switch to that branch