mirror of
https://codeberg.org/james-smith-za/git-tidy-python.git
synced 2026-01-15 19:29:25 +02:00
More tweaks. I am more or less happy now.
This commit is contained in:
parent
01775362b3
commit
617eeb2c71
2 changed files with 50 additions and 48 deletions
31
README.md
31
README.md
|
|
@ -1,29 +1,18 @@
|
|||
# git-tidy
|
||||
|
||||
Have you ever come back to a git repo after a while, started developing, and
|
||||
then realised you weren't on the main branch, or your branch was missing the
|
||||
latest changes, so you ended up with merge conflicts?
|
||||
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.
|
||||
|
||||
Or have you ever finished working on a feature, completed a pull-request online,
|
||||
and wanted an easy way to clean up your local repo from all the unused
|
||||
references that have accumulated themselves?
|
||||
So this gets it cleaned up relatively quickly.
|
||||
|
||||
Then `git-tidy` is for you!
|
||||
It's more or less the equivalent of
|
||||
|
||||
This is a simple Python script which you can install by copying (or symlinking)
|
||||
anywhere on your path (I recommend ~/bin/, but something like /usr/local/bin/
|
||||
would also work).
|
||||
|
||||
Entering
|
||||
```bash
|
||||
git tidy
|
||||
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
|
||||
```
|
||||
at the terminal will:
|
||||
- Check out the default branch, usually `main`
|
||||
- if this is not configured, it will try to figure out what it should be,
|
||||
- Pull to make sure that you're up-to-date with the default branch,
|
||||
- Delete all branches that have already been merged into the default, and,
|
||||
- Delete all references which have been removed from the remote as well,
|
||||
|
||||
leaving you with a pristine, tidy repository in order to continue your
|
||||
development.
|
||||
with some extra convenience and (I hope) safety features.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue