Git Branches

Page content

some basic commands for branches. you can read the official page for more details

create branch

you wanna develope a feature, fix a bug, test some stuff … you need a branch !

git checkout -b feature1

push upstream

if you have a central repo, push the feature upstream (so others can checkout as well)

git push --set-upstream origin feature1

show branch

you may have multiple branches, list them all

git branch

switch branch

from master to feature1 and back to master

git checkout master
git checkout feature1
git checkout master

merge branch

if your’re fine with your code, you merge your branch into master

git checkout master
git merge feature1

git delete branch

finally, delete the branch and process with on the master

git branch -d feature1

Happy Git !

sha256: 5c77629c81653b110a1ae51e7d127821f2951412790c5050e0a424e9a1490037