Skip to content

Instantly share code, notes, and snippets.

@ludndev
Created September 14, 2019 22:58
Show Gist options
  • Save ludndev/4de72625c1ab4a538b0a8451ef27380f to your computer and use it in GitHub Desktop.
Save ludndev/4de72625c1ab4a538b0a8451ef27380f to your computer and use it in GitHub Desktop.
Useful Git Command
**Create a Branch**
git branch branch-name
**Checkout a Branch**
( _git checkout command switch branches or restore working tree files_ )
git checkout branchname
**Renaming a Branch**
git branch -m branch-old-name branch-new-name
**Delete a Branch**
git branch -d branch-to-delete
git branch -D branch-to-delete ( *force deletion without checking the merged status* )
**Create and Switch Branch**
git checkout -b branchname
**List all branches**
git branch ( *local only* )
git branch -r ( *remote only* )
git branch -a ( *remote and local* )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment