Git Workflow step by step - lan-solo-capstone/freeshare GitHub Wiki

Proper Git Hygiene/Git Workflow to Follow:

  1. Before you create a branch, make sure you have the latest changes

    "git checkout main"

    "git pull"

  2. Create local branch to start working on -> "git checkout -b newBranchName"

  3. Stage changes, commit, and push to LOCAL branch -> "git add . , git commit -m ‘ ', git push origin newBranchName"

THEN, EITHER:

  1. Switch to existing local branch and merge -> "git checkout newBranchName"
  2. Merge -> "git merge main newBranchName"

OR, IF YOU HAVE NO OLD CHANGES:

  1. Create and switch to brand new branch -> "git checkout -b newerThanNewBranchName"
  2. No merging necessary for new branch DONE!
  3. Happy coding! :)