-
Notifications
You must be signed in to change notification settings - Fork 41
Git and GitHub workflow for contibuting
The best method for contributing software to the mirage
project is a workflow that involves forking the mirage
repository, developing changes on personal branches, and opening pull requests through GitHub.
The first question you will have to figure out is whether you should open an issue for this update - if you think that this change will be solving a significant problem or add a significant enhancement to the project then it would be advantageous to open an issue ticket here. This will allow both individuals and the team as a whole to keep track of the project and our progress as we go. Any appropriate individuals should be assigned to the issue, and a label(s) should be tagged.
Following that, any changes that you want to eventually make to the master branch should be done through the workflow where you create a fork and work on your own branch before submitting those changes to be reviewed through a pull request. Instructions on how to do those things can be found below:
-
Create a personal fork of the
mirage
repository by visiting thespacetelescope
repository and clicking the Fork button. Note that this only has to be done once. -
Make a local copy of your personal fork by cloning the repository (e.g.
git clone [email protected]:username/mirage.git
, found by clicking the green "clone or download" button.). Note that, unless you explicitly delete your clone of the fork, this only has to be done once. -
cd
into your newly cloned repo, and ensure that the personal fork is pointing to theupstream
spacetelescope/mirage
repository with:git remote add upstream [email protected]:spacetelescope/mirage.git
. Note that this only has to be done once. -
Create a branch on the cloned personal fork to develop software changes on. Branch names should be short but descriptive (e.g.
new-database-table
orfix-ingest-algorithm
) and not too generic (e.g.bug-fix
). Also consistent use of hyphens is encouraged.-
git branch <branchname>
- you only need to do this when you first create your branch. -
git checkout <branchname>
- you can use this command to switch back and forth between existing branches. - Perform local software changes using the nominal git add/git commit -m cycle:
-
git status
- allows you to see which files have changed. -
git add <new or changed files you want to commit>
- stage updated files git commit -m 'Explanation of changes you've done with these files'
-
-
-
Push the branch to the personal fork of the GitHub repository - this will deliver all committed changes to the branch version on the web which makes it accessible to other team members. The following are the commands to do this:
-
git push origin <branchname>
for your first push, or -
git push <branchname>
will also work after the first push of your branch.
-
-
On the
spacetelescope/mirage
GitHub repository, create a pull request - there is a button for that on your fork's page. You will want to set the base fork pointing tospacetelescope:master
and the head fork pointing to the branch on your personal fork (i.e.username:branchname
). Note that if the branch is still under heavy development, you can putWIP:
at the beginning of the pull request title to signify that the pull request is still a work in progress (i.e.WIP: Example Pull Request Title
). Not until theWIP:
tag is explicitly removed will the pull request be deemed 'mergable'. -
Assign the pull request a reviewer, selecting a member of the
mirage
team. They will review your pull request and either accept the request and merge, or ask for additional changes. -
Iterate with your reviewer(s) on additional changes if necessary. This will involve addressing any comments on your pull request which can be found on this webpage. You may end up iterating over steps 4.ii, 4.iii and 5 several times while working with your reviewer - do not despair.
-
Once the pull request has been accepted and merged, you can delete your local branch with
git branch -d <branchname>
. -
If you wish to, you can keep a personal fork up-to-date with the
spacetelescope/mirage
fork by fetching and rebasing with theupstream
remote:git checkout master
git fetch upstream master
git rebase upstream/master