Here’s a quick Git Cheatsheet of some of the most frequent commands I find myself using, along with a brief description of what each command does:
git clone https://<username>:<password>@github.com/username/repository.git
git status (current branch status and changes)
git checkout -b branch_name (creates new branch, with given branch_name)
git add <path> (adds only the item in <path>, new and previously committed)
git add . (adds everything in the current directory, alternatively use git add --a)
git add -p (adds everything previously committed, interactively)
git add -u (adds everything previously committed non-interactively)
git commit (allows you to add a commit message to what you've already committed, using the editor of your choice)
git commit -am "GIT-1234 - message" (adds everything, and includes the commit message given)
git commit -m "GIT-1234 - message" (doesn't add anything, includes the commit message only)
git push -u origin HEAD (pushes the branch up to origin, and sets the upstream location locally for the branch)
git push origin HEAD (pushes the branch up to origin)
git fetch origin master;git merge FETCH_HEAD (Pulls master from origin, and merges it into the current branch)
git fetch -p (purges any deleted branches from remote)
git stash (record current state of directory)
git stash apply (restore state)
git stash list (list all stashes)
git stash clear (delete all git stashes)
git diff (check difference between current changes and head)
git diff master branch_name (check difference between master and branch_name)
git merge --abort (aborts a merge; especially useful when there are merge conflicts)
git reset --hard remote/branch (reset to what remote is)
git reset HEAD~1 --soft (undo most recent commit, have changes in staged state)
git reset (unstages changes)
git branch -d branch_name (deletes a local branch)
git clean -f (force clean up of any untracked files in current branch)
git merge -X theirs master (resolves conflict in the favor of master)