When working with git there are some best practices.
- always have a branch for a specific need (bug, feature, etc)
- when done, delete branch on server and locally (you can always recreate)
- Create branch from main
- if done locally, you will need to:
- create branch locally
- push to GitHub
- if done on GitHub, you will need to:
- create branch on GitHub
- on local git, ensure you're working on master branch
- pull from remote
- if done locally, you will need to:
- Perform your work
- Add changes to git staging
- Commit changes
- Push to remote branch (not origin)
- Request pull on GitHub to merge into master
- Checkout your master branch
- In git, run
git pull
and fix any merge issues. (Which there shouldn't be. If there are, fix and then do agit push REMOTENAME master
) - Checkout your branch when ready to work again.
- Perform a merge between this branch and master:
git merge master BRANCHNAME
- Push this change (even if just a Fast-forward update) to GitHub
- Continue steps 2-11 until ready to close/delete your branch.
- When done with branch, run:
git checkout master
- Follow the steps to delete your branch.