Skip to content

Instantly share code, notes, and snippets.

@balavec
Forked from TSMMark/delete_local_branches.sh
Created July 29, 2019 12:33
Show Gist options
  • Save balavec/e0e27663f8b089c3b578d3483324b8ae to your computer and use it in GitHub Desktop.
Save balavec/e0e27663f8b089c3b578d3483324b8ae to your computer and use it in GitHub Desktop.
Delete local branches that don't exist remotely
git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -n 1 git branch -D
# See: http://stackoverflow.com/a/28020809/2696867
mark$ git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -n 1 git branch -D
Fetching origin
From github.com:tsmmark/vydia
x [deleted] (none) -> origin/UI/description-errors
x [deleted] (none) -> origin/UI/even-more-style-tweaks
x [deleted] (none) -> origin/UI/make-merge-tags-look-more-disabled
x [deleted] (none) -> origin/UI/more-style-tweaks
x [deleted] (none) -> origin/UI/move-connect-socials
x [deleted] (none) -> origin/UI/remove-redundant-social-input-fields
x [deleted] (none) -> origin/UI/unconnected-vevo-disabled-title-text
* [new branch] ui/description-errors -> origin/ui/description-errors
* [new branch] ui/even-more-style-tweaks -> origin/ui/even-more-style-tweaks
* [new branch] ui/make-merge-tags-look-more-disabled -> origin/ui/make-merge-tags-look-more-disabled
* [new branch] ui/more-style-tweaks -> origin/ui/more-style-tweaks
* [new branch] ui/move-connect-socials -> origin/ui/move-connect-socials
* [new branch] ui/remove-redundant-social-input-fields -> origin/ui/remove-redundant-social-input-fields
* [new branch] ui/unconnected-vevo-disabled-title-text -> origin/ui/unconnected-vevo-disabled-title-text
Fetching staging
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for ec2-54-213-156-142.us-west-2.compute.amazonaws.com has changed,
and the key for the corresponding IP address 54.213.156.142
is unchanged. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /Users/mark/.ssh/known_hosts:16
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
REDACTED
Please contact your system administrator.
Add correct host key in /Users/mark/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/mark/.ssh/known_hosts:6
RSA host key for ec2-54-213-156-142.us-west-2.compute.amazonaws.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch staging
Fetching production
fatal: 'src/vydia.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch production
Deleted branch UI/445-email-on-guest-upload-complete (was d617b3a).
Deleted branch UI/confirmation-required-indicator-cc-form (was f32a36a).
Deleted branch UI/user-detail-page (was b96da79).
Deleted branch bug-more-fixes-for-advanced-rights (was 773a1a3).
Deleted branch bug/a2v/artist-name-overflow (was 0fed2b1).
Deleted branch bug/billing-date-in-past (was 321175e).
Deleted branch bug/fix-maintenance-mode (was b831d88).
Deleted branch bug/fix-renewal-presets-always-reverting-to-default (was ee2614d).
Deleted branch change-media-artist-bug (was 75da3f9).
Deleted branch feature/introduce-resque-scheduler-web (was 9e350cf).
Deleted branch feature/move_release_message_to_another_release (was cf6c739).
Deleted branch feature/youtube-import-routes (was 1fcbc56).
Deleted branch fork/redirect-after-payment-choose-service (was 24afb4f).
Deleted branch initial-notifications (was 8f05b96).
Deleted branch internal/add-backtrace-to-payment-revert-report (was f83e92d).
Deleted branch internal/random-failure-in-discounts-model-tests (was 5c9cc34).
Deleted branch internal/test-some-deployments (was 2d56df6).
Deleted branch poltergeist-integration-testing (was 04e02c1).
Deleted branch pr/842 (was ef37f1e).
Deleted branch spike/publisher-files-presenter (was 26cbe42).
Deleted branch staging (was ed83c49).
git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment