Skip to content

Managing Branches

AJ but at Work edited this page May 28, 2025 · 2 revisions
  1. Navigate to your root directory
  2. Bash git checkout -b branchName. The -b <branchname makes a new branch and switches you onto it
  3. Add changes by git add . and then commit them with git commit -m "Commit Message"
  4. Push the branch to Github: git push -u origin branchname. branchname can also be main. The -u sets the origin/branchname as the default remote for future git push/git pull.
  5. Merge changes (you can do this easily online or) git checkout main git pull git merge branchname git push origin main
  6. Delete the local branch git branch -d branchName If you didnt' delete on Github online, drop the remote reference: git push origin --delete branchName git fetch --prune deletes any local branch that doesn't show online
Clone this wiki locally