Skip to content

Instantly share code, notes, and snippets.

@uilian
Last active February 23, 2023 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uilian/7beb347d6ea24e80b853fc866a9dc13f to your computer and use it in GitHub Desktop.
Save uilian/7beb347d6ea24e80b853fc866a9dc13f to your computer and use it in GitHub Desktop.
Git Utils
# find string accross all git revisions
git grep "string/regexp" $(git rev-list --all)
# diff file between two different branches or tags
git diff master 21.5.5.1 src/files/example.txt
# show file history
git log --stat src/customProperties.json
git log --graph src/customProperties.json
# edit git history to remove files
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch FILE-TO-BE-FORGOTTEN" HEAD
# or
bfg --delete-files FILE_TO_BE_DELETED
# or
git-filter-repo --invert-paths --path FILE/TO/BE/DELETED --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment