git branch


git branch

  • Branch is pointer to changes commited by you

What to do?

  • To check on which branch you are woking now

    git brach

  • To create new branch

    git branch

  • Change the working to branch to what you want

    git checkout

  • Now just change one file

    git status

  • Add this file

    git add

  • Commit the changes with msg

    git commit -m "new file added"

  • Push to remote repository

    git push -u origin

  • Now lets merge the brach with master

    git checkout master

It is switching to master branch

git pull origin master

It is checking is there any modifications done by any one in remote repository

git branch --merged

It checks branches are meged or not

git merge

It merges to master

git push -u origin master

It is pushing repo to remote directory in branch master

  • Now we can sent changes to master branch then we dont require (i.e. we have created) so we are going to delete it

  • To delete the branch locally

    git branch -d

  • To delete the branch remotely

    git push origin --delete

Thank you,

© Ganesh Hubale. Built using Pelican Share: Facebook Twitter