Git Workflow step by step - lan-solo-capstone/freeshare GitHub Wiki
Proper Git Hygiene/Git Workflow to Follow:
-
Before you create a branch, make sure you have the latest changes
"git checkout main"
"git pull"
-
Create local branch to start working on -> "git checkout -b newBranchName"
-
Stage changes, commit, and push to LOCAL branch -> "git add . , git commit -m ‘ ', git push origin newBranchName"
THEN, EITHER:
- Switch to existing local branch and merge -> "git checkout newBranchName"
- Merge -> "git merge main newBranchName"
OR, IF YOU HAVE NO OLD CHANGES:
- Create and switch to brand new branch -> "git checkout -b newerThanNewBranchName"
- No merging necessary for new branch DONE!
- Happy coding! :)