Git Cheat Sheet
Seeing all the files changed, when seemingly nothing changed?
Ignore File Permission changes in Linux
git config core.fileMode false
Getting stuck with pulls?
When pulling, if you have unstaged changes:
git pull --rebase --autostash
Delete all local branches
git branch --merged | grep -v \* | xargs git branch -D
Do not want to see line endings?
Just set them as-is.
git config --global core.autocrlf input
... or for windows:
git config --global core.autocrlf true
#### Delete GIT history of a branch
Pushed secrets to the repo? Have to delete ALL git history? This is how:
Create a new branch
git checkout --orphan latest_branch
Add all the filesHaving problem with
git add .
Commit the changes
git commit -m "commit message"
Delete the branch
git branch -D main
Rename the current branch to main
git branch -m main
Finally, force update your repository
git push -f origin main
Remember GIT credentials
git config --global credential.helper store
git config --global credential.helper cache
Get latest commit's data
git log -1 --format="%H %s %ae"
Generate customizable git diffs
https://github.com/orhun/git-cliff
git linux