-
Notifications
You must be signed in to change notification settings - Fork 0
Managing Branches
AJ but at Work edited this page May 28, 2025
·
2 revisions
- Navigate to your root directory
- Bash
git checkout -b branchName. The-b <branchnamemakes a new branch and switches you onto it - Add changes by
git add .and then commit them withgit commit -m "Commit Message" - Push the branch to Github:
git push -u origin branchname.branchnamecan also bemain. The-usets theorigin/branchnameas the default remote for futuregit push/git pull. - Merge changes (you can do this easily online or)
git checkout maingit pullgit merge branchnamegit push origin main - Delete the local branch
git branch -d branchNameIf you didnt' delete on Github online, drop the remote reference:git push origin --delete branchNamegit fetch --prunedeletes any local branch that doesn't show online