gh-poi icon indicating copy to clipboard operation
gh-poi copied to clipboard

Delete the tracking branch as well.

Open OkazakiTokkatsu opened this issue 2 years ago • 1 comments

Description

I would like the tracking branch (remotes/origin/****) removed at the same time.

Steps to reproduce

  1. 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
    
  2. 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
    
  3. 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
    
  4. Run prune

    $ git fetch --prune
    
     - [deleted]         (none)     -> origin/some-topic-branch
    
  5. 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

OkazakiTokkatsu avatar Jul 28 '22 04:07 OkazakiTokkatsu

Thanks for giving me a good feature request. I will check a little more to see if this change has any negative impact.

seachicken avatar Jul 29 '22 23:07 seachicken

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)

seachicken avatar Aug 11 '22 02:08 seachicken