# --force-if-includes only works if local and remote brach names are the same

1 messages from 2023-07-26 to 2023-07-26. Participants: Stefan Haller.
Thread: https://gitlist.dev/t/60031

## Stefan Haller, 2023-07-26 19:02

Subject: --force-if-includes only works if local and remote brach names are the same
Message-ID: <f51c73ed-eb03-83ca-fb31-d3e2645c9a63@haller-berlin.de>
URL: https://gitlist.dev/e/f51c73ed-eb03-83ca-fb31-d3e2645c9a63%40haller-berlin.de

```
The --force-if-includes option of git push only seems to work if my
local ref matches the name of the remote ref that I'm pushing to. It
would be nice if I could also use it if that's not the case.

For example:

  git checkout -b main-myremote myremote/main
  git push -u myremote main-myremote:main
  # Hack hack hack, rebase rebase
  git push --force-if-includes --force-with-lease

This fails, as it does the check_if_includes_upstream check against the
local main, which is unrelated.

(Cc'ing a few people who were involved in the review of the patch series
that introduced the --force-if-includes option.)

-Stefan

```
