
See all branches
# local
git branch
# local + remote
git branch -a
Create xyz branch
git branch xyz
Create xyz branch from another[master] branch and switch to it
git checkout -b xyz main
Create xyz branch from another[main] branch
git branch xyz main
Create a local branch from a remote[github] branch (you can use after cloning master branch)
git checkout -b xyz origin/xyz
Push the new xyz branch to Remote
git push --set-upstream origin xyz
Putting XYZ Changes On Master Branch
git checkout main
# Merge, if there are conflicts, you can abort with -> **git merge --abort**
git merge xyz
# Merge with 'ort' strategy. Create a commit for the merge.
****git merge xyz --no-ff -m "Making a merge"
git branch -d xyz -> remove xyz branch
git push origin -d xyz -> remove remote xyz branch
Pull from master branch to update your xyz branch
git checkout xyz
git pull origin main
Synchronize with remote
git fetch <remote>