Git Command Cheat-Sheet with Actual Examples

Git Commit:

git commit -m "Title of commit goes here" -m "Description of commit goes here"

Git Status – See what files have been changed. Of these, see which are being tracked to be added to the next commit.

git status

Push to Origin

git push origin

Create new branch – Git Checkout

git checkout -b name-of-my-new-branch

List the branches in your repo – Git Branch

git branch

Check remote repo

git remote

Rename local branch (See this article: https://multiplestates.wordpress.com/2015/02/05/rename-a-local-and-remote-branch-in-git/)

git branch -m oldname newname

1. Rename your local branch.
If you are on the branch you want to rename:

1git branch -m new-name

If you are on a different branch:

1git branch -m old-name new-name

2. Delete the old-name remote branch and push the new-name local branch.

1git push origin :old-name new-name

3. Reset the upstream branch for the new-name local branch.
Switch to the branch and then:

1git push origin -u new-name

Subscribe to new blog posts