gh-poi
gh-poi copied to clipboard
Delete the tracking branch as well.
Description
I would like the tracking branch (remotes/origin/****)
removed at the same time.
Steps to reproduce
-
Ensure that the merged branch remains.
$ git branch -a some-topic-branch * main remotes/origin/some-topic-branch remotes/origin/HEAD -> origin/main remotes/origin/main
-
Run gh-poi
$ gh-poi ✔ Fetching pull requests... ✔ Deleting branches... Deleted branches Some-topic-branch └─ #1 https://github.com/Okako-WebWorks/TicketSystem/pull/*** Not deleted branches * main
-
Ensure that the tracking branch remains in place.
$ git branch -a * main remotes/origin/some-topic-branch remotes/origin/HEAD -> origin/main remotes/origin/main
-
Run prune
$ git fetch --prune - [deleted] (none) -> origin/some-topic-branch
-
Now, all branches was cleaned!
$ git branch -a * main remotes/origin/HEAD -> origin/main remotes/origin/main
Perhaps the prune executed here should be done by gh-poi. (The above command may not be sufficient to avoid gh-poi deleting tracking branches other than the one you deleted.)
Additional context
gh version 2.14.3 (2022-07-26) gh poi seachicken/gh-poi v0.5.6
Thanks for giving me a good feature request. I will check a little more to see if this change has any negative impact.
I thought pruning was also good for the purpose of this tool to clean up.
I would proceed with the following policy:
With --dry-run
: Do not pruning
Without --dry-run
: git remote prune
after removing branches (git fetch --prune
includes getting remote-tracking branches, so we will proceed without fetch)