Git Workflow Cheat Sheet
This is a cheat sheet for the Git workflow described in this tutorial: A Simple Project Management Workflow for Ionic Developers. For more information on setting up the workflow initially, please read that tutorial. This cheat sheet will only contain the commands needed for using this workflow after the initial set up.
Starting work on a new issue
- Checkout and update the
main
ormaster
branch with the latest changes:
git checkout main
git pull
- Create a new branch using the format
[your-initials]-[issue-number]
or any consistent format you prefer:
git checkout -b jm-10
- Send changes back to the remote branch referencing the relevant issue number in the commit message:
git add .
git commit -m "#10 added E2E test"
git push --set-upstream origin jm-10
NOTE: --set-upstream origin branch-name
is only required for the first push back to the remote repository
Finishing work on an issue
If the work is complete and does not require a refactor or review, use the closes
syntax to automatically close the relevant issue and move it to the Done column in the Kanban board:
git add .
git commit -m "closes #10 finished the feature"
git push
Merging back into the main branch
- Make sure
main
ormaster
is up to date:
git checkout main
git pull
- Merge changes from
main
into your branch:
git checkout jm-10
git merge main
NOTE: If there are conflicts (i.e. a change you have made collides with a change in main
) you will see a message stating which files contain conflicts. You will need to open these files, resolve the conflicts, and then add/commit those files. Keep in mind that after running git merge
you can run git merge --abort
to undo that action.
- Merge the branch into
main
:
git checkout main
git merge jm-10
git push
(Optional) Remove the branch
git push origin --delete jm-10
git branch -d jm-10