Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Branch Managment
- ## How to create a branch
- ```cmd
- git branch my-branch
- ```
- ## How to use the new branch or move to another branch
- ```cmd
- git checkout my-branch
- ```
- ## How to list all the branches
- ```cmd
- git branch
- ```
- ## How to push the new branch
- ```cmd
- git push -u origin my-branch
- ```
- ## How to list remote branches
- ```cmd
- git branch -a
- ```
- ## How to list all the branches that have been merged into the current branch (locally and remotely)
- ```cmd
- git branch --merged
- git branch -a --merged
- ```
- ## How to merge a branch
- We need to follow the next steps:
- ```cmd
- git checkout master
- git pull origin master
- git branch --merged
- git merge my-branch
- git push origin master
- ```
- ## How to delete a branch (local and remote)
- The first command will delete `my-branch` branch locally and the next one remotely
- ```cmd
- git branch -d my-branch
- git push origin -d my-branch
- ```
Add Comment
Please, Sign In to add comment