Skip to content
mitochondrion edited this page Jul 28, 2017 · 31 revisions

Configuration

https://github.com/mitochondrion/dotfiles/blob/master/.gitconfig https://github.com/mitochondrion/dotfiles/blob/master/.gitignore

Bisect

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

Resolve One sided merge conflict

git checkout --ours [FILE]
git checkout --theirs [FILE]

Cleanup

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]

List remote merged branches

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

Remove a pushed /Pods folder

git filter-branch --index-filter 'git rm --cached --ignore-unmatch Pods/*' --tag-name-filter cat -- --all
git push --force

Tags

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

Clone this wiki locally