-
Notifications
You must be signed in to change notification settings - Fork 0
Git
alex [dot] kramer [at] g_m_a_i_l [dot] com edited this page Aug 30, 2023
·
31 revisions
⏣SUPERIOR ULTRABEST™⏣ Git config. Provides fancy-pants aliases, sane default settings, and other useful miscellanea:
https://github.com/mitochondrion/dotfiles/blob/master/.gitconfig
https://github.com/mitochondrion/dotfiles/blob/master/.gitignore
Allow git hooks to be checked in with the repo
git config core.hooksPath .githooks
GIT_TRACE=2 [GIT_COMMAND]
git log -G[REGEX] --branches --all
git log -c -S'missingtext' /path/to/file
git bisect start
git bisect good [working commit]
git bisect bad [broken commit]
git bisect [good|bad] # repeat until git finds the first bad commit
git bisect reset
git remote add upstream git://github.com/[UPSTREAM_REPO].git
git fetch upstream -p
git rebase upstream [BRANCH]
git checkout --ours [FILE]
git checkout --theirs [FILE]
git stash list | awk -F: '{ print "\n\n\n=========="; print $0; print "==========\n\n"; system("git stash show -p " $1); }'
Clean local branches
git branch
git co develop
git branch --merged
git branch -d [MERGED BRANCH TO DELETE]
git branch --no-merged
git branch -D [UN-MERGED BRANCH TO DELETE]
Clean remote branches
git fetch -p (OR git remote prune origin)
git branch -r
git branch -r --merged
git push origin --delete [REMOTE BRANCH TO DELETE]
Merged:
for branch in `git branch -r --merged | grep -v HEAD`; do echo -e `git show --format="%ci %cr %an" $branch | head -n 1` \\t$branch; done | sort -r
Un-merged:
for branch in `git branch -r --no-merged | grep -v HEAD`; do echo -e `git show --format="%ci %cr %an" $branch | head -n 1` \\t$branch; done | sort -r
git filter-branch --index-filter 'git rm --cached --ignore-unmatch Pods/*' --tag-name-filter cat -- --all
git push --force
Move tag:
git fetch -p --tags
git tag -d [tag]
git tag [tag]
git push --tags -f
Latest tag:
git describe --abbrev=0 --tags
Tag of current commit:
git tag -l --points-at HEAD
git log --follow BRANCH -- FILE