2023-01-26 07:43:08 +02:00
|
|
|
# git-tidy
|
|
|
|
|
2023-01-28 22:39:06 +02:00
|
|
|
I wrote this utility to save myself some repetitive typing, because I often come
|
|
|
|
back to a repo after a while of not using it, and in the meanwhile a remote may
|
|
|
|
have moved on or I'm not sure what state it's in.
|
2023-01-26 07:43:08 +02:00
|
|
|
|
2023-01-28 22:39:06 +02:00
|
|
|
So this gets it cleaned up relatively quickly.
|
2023-01-26 07:43:08 +02:00
|
|
|
|
2023-01-28 22:39:06 +02:00
|
|
|
It's more or less the equivalent of
|
2023-01-26 07:43:08 +02:00
|
|
|
|
|
|
|
```bash
|
2023-01-28 22:39:06 +02:00
|
|
|
git checkout main
|
|
|
|
git fetch --all --purge # purge is to delete unnecessary remote refs
|
|
|
|
git merge origin/main main --ff-only
|
|
|
|
git branch --merged | grep -v main | xargs git branch -d
|
2023-01-26 07:43:08 +02:00
|
|
|
```
|
|
|
|
|
2023-01-28 22:39:06 +02:00
|
|
|
with some extra convenience and (I hope) safety features.
|
2023-01-28 22:41:50 +02:00
|
|
|
|
|
|
|
The repo is named with `-python` on the end because I have a vague ambition to
|
|
|
|
redo this program in Go at some point, which will make it easier to distribute
|
|
|
|
for people who don't have Python installed by default (i.e. Windows users). But
|
|
|
|
I'm not sure when I'll get to that.
|
|
|
|
|
|
|
|
|
|
|
|
## TODO
|
|
|
|
|
|
|
|
I'd like to actually get a set of unit-tests in place, but I'm not sure how to
|
|
|
|
go about this really because there's a lot of subprocess calls. If anyone reads
|
|
|
|
this and has an idea, I'd be glad to hear from you.
|