For more details, please read http://developer.lsst.io/en/latest/processes/workflow.html
IMPORTANT: check which branch you are on before you do any commit
git branch
1. branch naming convention
- user branch u/{topic} u/mytest
- Jira ticket branch DM-NNNN-[short description] DM-4532
- IRSA ticket I-NNNN-[short description] I-4532
short description is mandatory.
NNNN is the ticket number in Jira DM-NNNN, or IRSA ticket number
2. create a branch off dev
git checkout dev
git pull --rebase origin dev (see notes on git pull --rebase)
git checkout -b [your new branch name]
3. rebase during the development on your branch
git checkout dev
git pull --rebase origin dev (see notes on git pull --rebase)
git checkout {your current working branch name}
git rebase dev
4. test your code in your own environment
5. repeat 3-4 until finished, to reduce conflicts and improve the integration
6. squash the commits into reasonable entries, then push
git checkout dev
git pull --rebase origin dev (see notes on git pull --rebase)
git checkout {your branch}
git rebase -i dev
git push origin {your branch}:{your branch}
7. make a pull request when ready for review
on github, create a pull request, more information is here: https://help.github.com/articles/creating-a-pull-request/
- On GitHub, navigate to the repository from which you'd like to propose changes.
- In the "Branch" menu, choose the branch that contains your commits.
To the right of the Branch menu, click New pull request.
- Change the base and compare branches to the ones of your choice
- Type a title and description for your pull request.
- Click Create pull request.
name your pull request: DM-NNNN: {Jira ticket title}
8. assign a reviewer, in Jira
open your ticket
change the the ticket state to “In Review”, put in the reviewer name when asked
Or go to the agile SUIT board in Jira, move ticket from in-progress to Review
9. review and review discussion
at https://github.com/Caltech-IPAC/firefly, click on Pull requests, click on the one to review
click on "Files changed" tab
put in concrete comments that are helpful to improve the code and beneficial to most developers.
please talk one to one for clarification discussion.
improvements on documentation of the work is always good thing.
9-2. while waiting for your ticket to be reviewed, start working on another ticket
git checkout {your branch}
git checkout -b [your new branch name]
10. ticket reviewed
reviewer open Jira ticket, change the status to “Reviewed”
11. make changes according to the review comments, squash the commits, then push
git checkout {your branch}
git pull origin {your branch}
git rebase -i {your branch}
git push origin {your branch}:{your branch}
12. merge at github (preferred way to merge)
delete your branch after merge
12-2. merging (only do this this if you did not merge on github, otherwise skip) (always use the non-fast-forward merges)
git checkout dev
git pull --rebase origin dev (see notes on git pull --rebase)
git pull origin
git merge --no-ff [your branch]
git push origin dev
13. delete your local branch (optional)
git fetch -p
git branch -d {your branch}
================ Notes on git pull --rebase ===========================
* Note 1 about 'git pull --rebase origin dev’
If you are pulling regularly then the --rebase option is the best. If you have not pulled in a couple of weeks then it is possible that there will be too many changes and the rebase will be too messy. If you are concerned that a rebase is creating more mess then is should be then abort it and to pull with a merge.
git pull --rebase origin dev
"oh, no, this rebase is a mess!!!”
git rebase --abort
git pull --no-rebase origin dev
go though the merge process
* Note 2 about 'git pull --rebase origin dev’
When there a conflicts but not too many. The commands are slightly different than merge.
git pull --rebase origin dev
"oh, no, this rebase has conflicts but it is not too bad”
fixed the conflicts
git add [filename] <— each file you fixed.
git rebase continue