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

git refusing to merge branches when pulling using a refspec

From
SPSantiago García Pimentel <santiago@garciapimentel.com>
Date
Nov 6, 2023, 17:36 UTC
Message-ID
<FC0625CD-D736-412C-A4C5-04F9F41FFEEA@garciapimentel.com>
Hello,
I'm dealing with a small automation (CI) to synchronise some specific branches between two git repositories.
I need to sync a branch with other using a user-given refspec. e.g.
$ git pull origin "refs/heads/branchOrigin:refs/heads/branchDestination”.
(I’ll have a list of refspecs, but so far Im trying to make it work with one)
When the branch can be fast-forwarded there is no problem, but I cannot manage to make it work when it cant.
I just. get the message "[rejected] branchOrigin -> branchDestination (non-fast forward)."
I've tried  the following:
- adding a git config with pull.rebase=false  (I also tried true)
- adding --no-rebase to the pull command  (I also tried —rebase)
In any cases the result is the same
The issue is, It does work if I just pass the branch names. e.g.
git pull origin branchOrigin --no-edit
merges the branch just fine
Im not sure why git refuses to merge the branches when I pass a full refspec. is this intentional? is there some other incantation I need to use to make this work?
Thank you!

Santiago García Pimentel. santiago@garciapimentel.com

Next: Junio C Hamano
Message 1 of 2 in “git refusing to merge branches when pulling using a refspec”
  1. Santiago García PimentelNov 6, 2023
  2. Junio C HamanoNov 6, 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.