git stash -u: store all your current changes to check in another time. For instance, you are in branch A and need to go to branch B, but haven't finished the alterations in branch A yet.-uenforces that non tracked files are stashed too.git stash drop: pull away your stashed changes.git stash pop: restore your stashed changes.
git reflog: show all explicit changes made in your repo.git reflog show [BRANCH]: show all explicit changes made in your branch.git reset --hard [HASH]: reflog associate to each change a hash, and specifying it in this command make you return your repo to this stage.
git log --oneline --decorate --graph --all -30:--oneline: one line log version.--decorate: display the local and remote branches along with the commit hash.--graph: draw simple lines to represent branches.--all: search in all branches (instead only the current).-30: number limit of logs to show.
git log --pretty=format:'%C(yellow)%h%C(reset) - %an [%C(green)%ar%C(reset)] %s': prettify log in a specific format.git log --grep -E -i 'cach(e|ing)': search logs by commit message--grep: says that you will search by a specific string or pattern.-E: you will use regular expressions.-i: case insensitive.git log -S [PIECE_OF_CODE]: search logs by code change (for instance, PIECE_OF_CODE = your_method_name).-Sis the argument that allow this kind of search.git log -- [FILE_NAME: file specific log.git blame [FILE_NAME]: shows what revision and author last modified each line of the file.git show [COMMIT_HASH]: shows all alterations made in a specific commit (like a diff file).
git config --global alias.car 'commit --amend --no-edit': example of hot to create an alias.
git reset [FILENAME]: remove from staging areagit reset --soft HEAD^: reset the branch to the point to the point that parent commit was, but don't change the index and working directory.