Skip to content

Detect and alert (or otherwise handle) when local branch is out of sync with remote #134

@cabbey

Description

@cabbey

When the remote repo has branches that are not in sync with the local one, the tool gives a very clear warning:

Remote 'cabbey' is not up to date with 1 local branch(es):
  - main

This will likely impair detection of merged branches for remote 'cabbey'.
Please consider getting it back in sync by running
  $ git push cabbey main

and then invoking git-delete-merged-branches, again.

However when the opposite is true, you just get a warning and error from git and an overall failure:

warning: not deleting branch 'improve-encryption' that is not yet merged to
         'refs/remotes/cabbey/improve-encryption', even though it is merged to HEAD.
error: The branch 'improve-encryption' is not fully merged.
If you are sure you want to delete it, run 'git branch -D improve-encryption'.
Deleted branch bye-render (was 30e49492767).
Deleted branch crop-vs-orientation (was 95b84c24f6d).
...
Error: Command 'git branch --delete bye-render crop-vs-orientation improve-encryption ...' returned non-zero exit status 1.

It would be nice if the tool could detect that this is going to happen and either omit those branches from the delete command and explain to the user that they are not in sync. (In my case there had been a last minute merge of main into the branch, which was then merged to main and pushed up to upstream, but was not pushed to my personal fork. I just did a git branch -D improve-encryption and re-ran the tool.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions