GIT MISC

Alias

The add & rm & reset & commit & checkout Sub-commands.

The git Rebase Sub-command

Advantage of rebase:

Disadvantage of rebase:

Golden rule of git rebase:

never use it on public branches.

When to use rebase

The reset, checkout And revert Sub-commands

The parameters that you pass to git reset and git checkout determine their scope. When you don’t include a <file path> as a parameter, they operate on whole commits. Note that git revert has no file-level counterpart

from atlassian’s git tutorials

Commit level operations

git reset --[soft | mixed | hard] <commit-ish> move branch tips backwards or even forwards, while affecting staging area & working direcotry according to options it is given.

option history staging area working directory
--soft
--mixed
--hard

git checkout <commit-ish> dose not move tips around.

git revert undo commits by adding a new commit. it is a safe (reversible) way to undo commits, while git reset is dangerous (irreversible) way to undo commits.

File level operations

git [reset|checkout] <commit-ish> <pathspec>
command history staging area working directory
reset
checkout

Summary

command commit level file level
reset discard commits in private branches or throw away uncommited changes unstage a file
checkout swtich between branches or inspect old snapshots discard changes in the working directory
revert undo commits in public branches N/A