Some Useful git Commands

Show pending changes that can be added to repo:

git status

Add all pending changed files to pending commit list:

git add -A

Commit all pending additions to the current branch with a message of “Message”:

git commit -a -m "Message"

Pushes current branch to default remote:

git push

Pushes {branch name} changes to {remote repo name}:

git push {branch name} {remote repo name}

Resets a file back to previous state after adding to pending commit list:

git reset {file name}

Creates a branch named {branch name}:

git branch {branch name}

Switches to a branch named {branch name}:

git checkout {branch name}

Creates and switches to a branch named {branch name}:

git checkout -b {branch name}

Adds a reference to a remote repo that can be pushed to:

git remote add {remote repo name} {remote repo uri}