A collection of useful git commands
CAUTION: git reset --hard
will delete all local changes
Delete commit
git reset --hard HEAD~<no of commit before HEAD>
git reset --hard <commit id>
Push to server
git push origin <branch name> --force
https://stackoverflow.com/a/1338744/11523048
https://stackoverflow.com/questions/1338728/delete-commits-from-a-branch-in-git/
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT <commit 1 id>..<commit 2 id> | tar -cf file.tar -T -
https://stackoverflow.com/a/4541846/11523048
https://stackoverflow.com/questions/4541300/export-only-modified-and-added-files-with-folder-structure-in-git/
git log --graph --decorate $(git rev-list -g --all)
https://stackoverflow.com/a/16368880/11523048 https://stackoverflow.com/questions/16368605/is-there-a-tool-to-have-git-show-detached-heads-in-a-graph
git am *.txt
in Linux is equivalent to the following in Windows PowerShell
git am $(ls *.txt | % {$_.FullName})
https://superuser.com/a/460651
https://superuser.com/questions/460598/is-there-any-way-to-get-the-windows-cmd-shell-to-expand-wildcard-paths/
List added files