Skip to content

Instantly share code, notes, and snippets.

@nathanchance
Last active September 18, 2020 23:45
Show Gist options
  • Save nathanchance/04a0701e4b779c9ee833e09c8a69ab0b to your computer and use it in GitHub Desktop.
Save nathanchance/04a0701e4b779c9ee833e09c8a69ab0b to your computer and use it in GitHub Desktop.
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
Example:
for i in $(git ls-remote -q | grep "refs/head" | cut -d '/' -f 3 | awk '!(/^7.1.2-flash$/)'); do git push origin :$i; done
Add a git log for merge commits:
git merge --log=$(git rev-list --count <CURRENT_BRANCH>..<BRANCH_TO_MERGE>) <BRANCH_TO_MERGE>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment