Skip to content

Instantly share code, notes, and snippets.

View akhilnarang's full-sized avatar

Akhil Narang akhilnarang

View GitHub Profile
@nathanchance
nathanchance / gitfu
Last active September 18, 2020 23:45
Reset all files that conflict but keep the non-conflicted ones:
for i in $(git status | grep "both modified" | awk '{print $3}'); do git reset HEAD $i && git checkout -- $i; done
Delete all branches but one
for i in $(git ls-remote -q | grep "refs/head" | cut -d '/' -f 3 | awk '!(/^<BRANCH_NAME_TO_KEEP>$/)'); do git push origin :$i; done