Development and more...

GitSheet

Simple git cheatsheet

Branches

git branchList all local branches.
git branch -aList remote and local branches.
git checkout -b [branch_name]Create a local branch and switch to it.
git checkout [branch_name]Switch to an existing branch.
git push origin [branch_name]Push branch to remote.
git branch -m [new_name]Rename current branch.
git branch -d [branch_name]Delete a local branch.
git push origin :[branch_name]Delete a remote branch.

Logs

git log --onelineShow commit history in single line.
git log -[N]Show commit history for last [N] commits.
git log -p -[N]Show commit history for last [N] commits with diff.
git diffShow all local file changes in the working tree.
git diff [file]Show changes made to a [file].
git blame [file]Show who changed what & when in a file.
git remote show originShow remote branches and their mapping to local.

Cleanup

git clean -fDelete all untracked files.
git clean -dfDelete all untracked files and directories.
git checkout -- .Undo local modifications to all files.
git reset HEAD [file]Unstage a file.

Tags

git pull --tagsGet remote tags.
git checkout [tag_name]Switch to an existing tag.
git tagList all tags.
git tag -a [tag_name] -m "tag message"Create a new tag.
git push --tagsPush all tags to remote repo.

Stashes

git stash save "stash name" && git stashSave changes to a stash.
git stash listList all stashes.