foriequal0 / git-trim

Automatically trims your branches whose tracking remote refs are merged or stray
MIT License
489 stars 14 forks source link

Use all remote HEADs #175

Open foriequal0 opened 4 years ago

foriequal0 commented 4 years ago

Fixes: #174

siedentop commented 4 years ago

I still have the same (or similar) error as in #174. I installed git-trim from this branch.

EDIT: This also happens when I run it with --no-detach.

[2020-11-13T19:18:51Z TRACE git_trim::subprocess] | c0e130257676fec91b4e452ea1f3e240bdd966dc
[2020-11-13T19:18:51Z TRACE git_trim::subprocess] > git rev-list --cherry-pick --right-only --no-merges -n1 refs/remotes/upstream/master...1ade483b12d615a184ad092bc970ee6b5c3d71fc
[2020-11-13T19:18:51Z TRACE git_trim::subprocess] | 1ade483b12d615a184ad092bc970ee6b5c3d71fc
[2020-11-13T19:18:51Z DEBUG git_trim::core] Result #1: ClassificationResponse {
        message: "local & upstream are merged",
        result: [
            MergedLocal(
                LocalBranch {
                    refname: "refs/heads/master",
                },
            ),
            MergedRemoteTracking(
                RemoteTrackingBranch {
                    refname: "refs/remotes/origin/master",
                },
            ),
        ],
    }
[2020-11-13T19:18:51Z DEBUG git_trim::core] Result #0: ClassificationResponse {
        message: "local & upstream are not merged yet",
        result: [],
    }
[2020-11-13T19:18:51Z TRACE git_trim::subprocess] > git worktree list --porcelain
[2020-11-13T19:18:51Z TRACE git_trim::subprocess] | worktree /home/user/src/git-trim
[2020-11-13T19:18:51Z TRACE git_trim::subprocess] | HEAD 385d8818e3b8db9a73b0f32993f53d1ba0d31386
[2020-11-13T19:18:51Z TRACE git_trim::subprocess] | branch refs/heads/master
[2020-11-13T19:18:51Z TRACE git_trim::core] Delete range result: MergedLocal(LocalBranch { refname: "refs/heads/master" }) => None
[2020-11-13T19:18:51Z TRACE git_trim::core] Delete range result: MergedRemoteTracking(RemoteTrackingBranch { refname: "refs/remotes/origin/master" }) => None
Branches that will remain:
  local branches:
    all-your-bases
  remote references:
    upstream/all-your-bases
    upstream/master *3
  Some branches are skipped. Consider following to scan them:
    *3: Make it upstream of a tracking branch or add `--delete 'remote:upstream' flag.

Delete merged local branches:
  - master
Delete merged remote refs:
  - origin, refs/heads/master
Confirm? yes
[2020-11-13T19:18:55Z TRACE git_trim::subprocess] > git push --delete origin refs/heads/master
To https://github.com/siedentop/git-trim.git
 ! [remote rejected] master (refusing to delete the current branch: refs/heads/master)
error: failed to push some refs to 'https://github.com/siedentop/git-trim.git'
Error: Operation not permitted (os error 1)
foriequal0 commented 4 years ago

I've fixed notification for remote head changes. It'll tell you what to do.