-
Disable chmode change detection:
git config core.fileMode false
git -c core.fileMode=false status //for single command -
Check which branches are merged:
git checkout master
git branch --merged -
Check which branches are NOT merged:
git branch --no-merged -
Delete all branches that are merged:
git branch --merged | xargs git branch -d -
Make git search renamed files when merging
git config merge.renameLimit 999999 //999999 - number of renamed files to search -
Find something in your entire git history
git rev-list --all | xargs git grep '<YOUR REGEX>'
or
git rev-list --all | xargs git grep -F '<YOUR STRING>' -
Fetch a file from another branch
git checkout <OTHER_BRANCH> -- path/to/file -
Which branches had the latest commits
git for-each-ref --sort=-committerdate --format='%(refname:short) %(committerdate:short)' -
Set git autocorrect (number of mistakes)
git config --global help.autocorrect 1 -
Recovering lost data
git log -g
or
git fsck --full -
Make branch based on commit
git branch my_lost_data [SHA-1] -
Cool one line log
git log --oneline --decorate -
Shorter git status
git status -sb -
Highlight word changes in diff
git diff --word-diff -
Set automatic rebasing when pushing
git config branch.master.rebase true -
Make git push changes to remote branch with similar name
git config --global push.default tracking -
Find out which branch has a specific change
git branch --contains [SHA-1] -
Show the last commit with matching message
git show :/regex -
Personal notes for commit
git notes add -
Make git blame smarter
git blame -w# ignores white space
git blame -M# ignores moving text
git blame -C# ignores moving text into other files
Last active
August 29, 2015 13:58
-
-
Save oleggreen/10016133 to your computer and use it in GitHub Desktop.
git tips
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment