git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
SHStefan Haller <lists@haller-berlin.de>
Date
Jul 26, 2023, 19:02 UTC
Message-ID
<f51c73ed-eb03-83ca-fb31-d3e2645c9a63@haller-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
Message 1 of 1 in “--force-if-includes only works if local and remote brach names are the same”
  1. Stefan HallerJul 26, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.