Workshop scratch area for demo purposes XXX
The demo will cover:
- github tool: graphs/metrics, pull request, code review
- commits and pushes
- branches and merging
Participants will need a github account to be able to interact with the IPAC repos and Git tool installed locally.
Participants will be guided through the following steps:
- clone the repos locally on their end (need git software installed)
git clone https://github.com/Caltech-IPAC/grits2018-tutorial.git- default landing branch should be
master(default per repos)git statusto check on which branch you are
- create your feature/ticket branch from
master
git checkout -b [branch name], required unique branch name, usually formatted asISSUE-ID-meaningful-short-description- For demo, let's append github
USERNAMEto branch name
- For demo, let's append github
- for example, let's take a look at epic from JIRA board IRSA-2060 and pick a ticket, i.e. IRSA-2062 improve the text
- my branch name will be IRSA-2062-improve-text
-
edit and change one line of the file in this repos named scratch.txt
-
commit your changes in your branch: add/commit
git add scratch.txtgit commit -m"[your message]"
-
continue changing/adding/commit and check the differences:
git show- Check your commit history:
git logor more fancygit log --decorate --graph - OPTIONAL: if no commit to be made, at that point, you can: pull or rebase
- after pulling, check branches pulled:
git branch --all - if
mastergot new things, you will need to rebase in order to avoid conflict at the time you pull request
-
Once done of changes, push to server (
-uflag means that you'll start tracking the branch)
- First time push:
git push -u origin [branch name] - Your local branch is now synced with remote
- Next pushes:
git push
- Pull Request: in github.com, button 'pull request' should appear
- Show a pull request / code review
- OPTIONAL Show a case of how to request changes (and what to do)
- if request change, need to go to the branch, and
- change file, git add / commit / (
rebase -ito squash) / push (steps 3 to 6 above) - no rebase there because branch is already in server / no force push either
- change file, git add / commit / (
- if request change, need to go to the branch, and
- Show when approve changes and merge from github
- Branch can be deleted from github after merged
-
OPTIONAL: If merge conflict (typically, same line have changed in the meantime: github will suggest commands and guidelines to solve and merge locally
-
Once merged, typically the branch can be deleted from github from the same pull request page.