|
@@ -1,23 +1,23 @@
|
|
# git branch
|
|
# git branch
|
|
|
|
|
|
-> Main command for working with branches.
|
|
|
|
|
|
+> Main git command for working with branches.
|
|
|
|
|
|
- List local branches. The current branch is highlighted by `*`:
|
|
- List local branches. The current branch is highlighted by `*`:
|
|
|
|
|
|
`git branch`
|
|
`git branch`
|
|
|
|
|
|
-- List all local and remote branches:
|
|
|
|
|
|
+- List all branches (local and remote):
|
|
|
|
|
|
`git branch -a`
|
|
`git branch -a`
|
|
|
|
|
|
-- Create new branch based on current branch:
|
|
|
|
|
|
+- Create new branch based on the current commit:
|
|
|
|
|
|
-`git branch {{BRANCH-NAME}}`
|
|
|
|
|
|
+`git branch {{branch_name}}`
|
|
|
|
|
|
-- Delete a local branch:
|
|
|
|
|
|
+- Rename a branch (must not have it checked out to do this):
|
|
|
|
|
|
-`git branch -d {{BRANCH-NAME}}`
|
|
|
|
|
|
+`git branch -m {{old_branch_name}} {{new_branch_name}}`
|
|
|
|
|
|
-- Move/Rename a branch:
|
|
|
|
|
|
+- Delete a local branch:
|
|
|
|
|
|
-`git branch -m`
|
|
|
|
|
|
+`git branch -d {{branch_name}}`
|