Guest User

Untitled

a guest
May 26th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. # Branch Managment
  2.  
  3. ## How to create a branch
  4.  
  5. ```cmd
  6. git branch my-branch
  7. ```
  8.  
  9. ## How to use the new branch or move to another branch
  10.  
  11. ```cmd
  12. git checkout my-branch
  13. ```
  14.  
  15. ## How to list all the branches
  16.  
  17. ```cmd
  18. git branch
  19. ```
  20.  
  21. ## How to push the new branch
  22.  
  23. ```cmd
  24. git push -u origin my-branch
  25. ```
  26.  
  27. ## How to list remote branches
  28.  
  29. ```cmd
  30. git branch -a
  31. ```
  32.  
  33. ## How to list all the branches that have been merged into the current branch (locally and remotely)
  34.  
  35. ```cmd
  36. git branch --merged
  37. git branch -a --merged
  38. ```
  39.  
  40. ## How to merge a branch
  41.  
  42. We need to follow the next steps:
  43.  
  44. ```cmd
  45. git checkout master
  46. git pull origin master
  47. git branch --merged
  48. git merge my-branch
  49. git push origin master
  50. ```
  51.  
  52. ## How to delete a branch (local and remote)
  53.  
  54. The first command will delete `my-branch` branch locally and the next one remotely
  55.  
  56. ```cmd
  57. git branch -d my-branch
  58. git push origin -d my-branch
  59. ```
Add Comment
Please, Sign In to add comment