Last active
February 25, 2020 19:55
-
-
Save loonywizard/683d7d67a97ffd6ff36775d2447e0294 to your computer and use it in GitHub Desktop.
List of commands for working with git branches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get list of all branches, current one will be marked with the * character | |
git branch | |
# create new branch called branch_name | |
git branch branch_name | |
# switch to existing branch called branch_name | |
git checkout branch_name | |
# create and checkout to just created branch, called branch_name | |
git checkout -b branch_name | |
# rename brunch called old_name to new_name | |
git branch -m old_name new_name | |
# rename current branch to new_name | |
git branch -m new_name | |
# remove local branch called branch_name | |
git branch -d branch_name | |
# push local branch called branch_name to remote repository | |
git push --set-upstream origin branch_name | |
# or | |
git push -u origin branch_name | |
# merge local branch called branch_name into your current branch | |
git merge branch_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment