-
Notifications
You must be signed in to change notification settings - Fork 3
Github Workflow
git pull origin main (is make sure main is up to date locally for you)
git checkout -b <<branch_name>> (create your new branch to work on your component)
Git branch Naming Conventions: short-issue-description/issue#
do work on branch
git add .
git commit -m “message”
Writing commit messages
type (optional: scope) : summary in present tense
Examples of types:
feat: (new feature for the user, not a new feature for build script)
fix: (bug fix for the user, not a fix to a build script)
docs: (changes to the documentation)
style: (formatting, missing semi colons, etc; no production code change)
refactor: (refactoring production code, eg. renaming a variable)
test: (adding missing tests, refactoring tests; no production code change)
chore: (updating grunt tasks etc; no production code change)
Examples commit messages: feat: improve performance with lazy load implementation for images chore: update npm dependency to latest version Fix bug preventing users from submitting the subscribe form
if you need to edit your commit message
git commit --amend -m "this commit message will replace the previous one" git push origin BRANCH-NAME --force - forcefully pushes this branch and replaces the remote version
git checkout main -- go back to the main branch
git pull origin main -- to make sure main is updated locally on your machine before merging
git checkout <<branch>>
git merge main : (merges main into your feature branch) – this is taking all the commits since you did made your branch and putting them at the end of your current branch, making sure you have all the new code from main in your branch
—-[ main ] — [ commit a ] — [ commit b ] |______[ your branch ] — [ commit c ] — [ commit a ] — [ commit b ]
above: example of what branches look like after merging with main
This is now when you fix merge conflicts in VS code (they will be highlighted - you pick to keep your changes, or mains or a bit of both).
if there are conflicts, then you will need to do the following after fixing them:
git add .
git merge --continue
if there are no conflicts, double check with git status and then proceed...
git push origin <<branch>>
Open a pull request (in github)
Slack teammates that you created one! (or better yet integrate GitHub with slack so you can get notifications when things are updated)
git fetch origin fetches all the remote branches added to the repo
git checkout THE-BRANCH-YOURE-REVIEWING switch into the branch you're reviewing to run and test it
git pull origin THE-BRANCH-YOURE-REVIEWING updates the local branch to the remote version
If you need you make changes to the branch, still use git add, git commit, git push to make the changes but let the original owner know that you're making changes to their branch
git branch -d <local-branch> deletes the local branch