Last active
May 1, 2025 10:34
-
-
Save blackpioter/bbc548aa1a9721dbccd3ec9c90800bd3 to your computer and use it in GitHub Desktop.
git cheatsheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## git reset hard to upstream | |
| git reset --hard @{u} | |
| ## git remove directory from history | |
| for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do\n git branch --track ${branch##*/} $branch\ndone | |
| git filter-branch -f --index-filter 'git rm --cached -r --ignore-unmatch DIRECTORY' \ | |
| --prune-empty --tag-name-filter cat -- --all | |
| git filter-branch --index-filter \ | |
| 'git rm -r --cached --ignore-unmatch DIRECTORY' HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment