Git Basic Command

Switch from branch to master
git checkout master

Push branch to remote server (github, etc)
git push origin [branch_name]

Create new branch
git checkout -b [branch_name]

Create new tag
git tag "[tag name]"

Push new tag to server
git push origin --tags

Inside the branch, pull from master
git pull origin master

Merge a git branch to master
git checkout master
git pull origin master
git merge [branch name]
git push origin master

Delete local branch
git branch -d [branch name]

Delete remote branch
git push origin --delete [branch name]

Revert last commit
git revert HEAD

updated on 17 January 2019

Comments