Interactive:
git rebase -i HEAD~3
git stash
git stash push -m 'stash title'
git stash list
git stash apply STASH-NAME # keeps stash
git stash pop STASH-NAME # removes stash
git stash drop STASH-NAME # delete named stash
git stash clear # delete all stashes
git stash show -p stash@{0} # show diff
git rm --cached mylogfile.log
$ git clean -dn
$ git clean -df
$ git clean -df --dry-run
git branch -m <new-name> # renames current branch
git branch -m <old-name> <new-name>
git branch <name> <commit-id>
git branch <name> HEAD@{n}
git repack -d
git gc --prune=now --aggressive
git fetch -p
Command Line Graph:
git log --graph
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
git add -p
git rev-list --count
git rev-list –count dev
git ls-files --others --exclude-standard -z |\
xargs -0 tar rvf ~/backup-untracked.zip
By time
git diff HEAD@{'2 months ago'}
git diff HEAD@{'2010-01-01 12:00:00'})
git log --pretty=format:"%h; %s" v0.0.2...v0.0.3
git log --pretty=format:"%h; %s" dev...main
Nicer Forced Push
Force push unless remote branch has already been updated
git push --force-with-lease
git archive --format=tar --remote=ssh://git@git-host.com/user/repo.git master distro.make | tar -xv
git format-patch -2
git format-patch HEAD~2..HEAD
git am *.patch
git am file.patch
List all your configuration
git config --list