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

Bug report for pull --rebase

From
MBMr Bill <billc56196@gmail.com>
Date
May 6, 2025, 21:36 UTC
Message-ID
<8c075e6e-c28c-4146-66bc-9bd7bc705611@gmail.com>

Hi, I ran across this doing a pull --rebase using the current master version of git

This happens on Slackware linux, using git HEAD, version 2.35.8, and 2.46.2

I have a clone of the ffmpeg video package, with a few custom commits on top of it, I periodically fetch and "pull --rebase" to update the underlying ffmpeg code. I tried this recently, and my custom commits disappeared.

I looked further with a small test, and it looks like this is happening:
The setup:
    "base" repo with a few commits (A, B, C)
    "clone_1" cloned from "base", with a few extra commits (F, G)
    "clone_2" cloned from "clone_1"
Add a few more commits for base (D, E)
Then use "git remote set-url origin" to point "clone_2" to "base"
Then, in "clone_2" do "pull --rebase"; the F and G commits disappear.
Then, in "clone_1" do "pull --rebase"; the F and G commits are retained.
Something like this:

# commit trees: # # base: A---B---C (initial base repo with 3 commits) # clone_1: A---B---C (clone_1 cloned from base at commit C) # base: A---B---C---D---E (base added extra commits D and E) # clone_1: A---B---C---F---G (clone_1 added extra commits F and G) # clone_2: A---B---C---F---G (clone_2 cloned from clone_1 at commit G) # # *** now, change clone_2 to use base as the upstream url, and fetch / pull / rebase to get up to date *** # # * set clone_2 upstream to point to base repo # * "pull --rebase" in clone_2 (should fetch from base repo and rebase F and G after D and E) # # expected result: A---B---C---D---E---F---G # actual result: A---B---C---D---E # commits F and G are gone # # Doing "pull --rebase" in clone_1 gives the expected result: # expected result: A---B---C---D---E---F---G #

This looks like either stale state info after the "set-url" command, or I'm doing something wrong.

I can repeatedly cause this to happen in my local ffmpeg devel area, if that helps debug/test this. ... and answer questions, if any.

Thanks for the help! Bill

P.S. here's the test script I used for this:
--------------------------------------------------------------------------
#!/bin/bash
set -o errexit
BASE_WORKING_DIR="rebase_bug.working"

# Clean up the test area rm -rf "${BASE_WORKING_DIR:?}" mkdir "${BASE_WORKING_DIR:?}" cd "${BASE_WORKING_DIR:?}"

WORKING_DIR="${PWD}"

mkdir test_rebase_base.git cd test_rebase_base.git

     # create the base git repo, with commit A, B and C
     git init
     echo "Commit A" > testfileA
     git add testfileA
     git commit -m "Commit A"
     echo "Commit B" > testfileB
     git add testfileB
     git commit -m "Commit B"
     echo "Commit C" > testfileC
     git add testfileC
     git commit -m "Commit C"
cd ..
     # Clone the base area into the clone_1 area
     git clone test_rebase_base.git test_rebase_clone_1.git
cd test_rebase_base.git
     # Add commit D and E to the base area
     echo "Commit D" > testfileD
     git add testfileD
     git commit -m "Commit D"
     echo "Commit E" > testfileE
     git add testfileE
     git commit -m "Commit E"
cd ..
cd test_rebase_clone_1.git
     # Add commit F and G to the clone_1 area
     echo "Commit F" > testfileF
     git add testfileF
     git commit -m "Commit F"
     echo "Commit G" > testfileG
     git add testfileG
     git commit -m "Commit G"
cd ..
     # clone from clone_1 into clone_2
     git clone test_rebase_clone_1.git test_rebase_clone_2.git
cd test_rebase_clone_2.git
     # change clone_2 to point to base
     git remote set-url origin "${WORKING_DIR:?}/test_rebase_base.git"
     # expecting this to pull in the "base" extra commits, and move the 
local HEAD commit after it in sequence
     git pull --rebase
cd ..
cd test_rebase_clone_1.git
     # do the same pull --rebase in clone_1
     git pull --rebase
cd ..

cd test_rebase_base.git git log --oneline > "${WORKING_DIR:?}/test_rebase_base.oneline.log" cd ..

cd test_rebase_clone_1.git git log --oneline > "${WORKING_DIR:?}/test_rebase_clone_1.oneline.log" cd ..

cd test_rebase_clone_2.git git log --oneline > "${WORKING_DIR:?}/test_rebase_clone_2.oneline.log" cd ..

# The test_rebase_clone_1.oneline.log and test_rebase_clone_2.oneline.log should match, but they don't

echo "done"
--------------------------------------------------------------------------------------------------
Next: D. Ben Knoble
Message 1 of 8 in “Bug report for pull --rebase”
  1. Mr BillMay 6, 2025
  2. D. Ben KnobleMay 9, 2025
  3. Tuomas AholaMay 9, 2025
  4. D. Ben KnobleMay 10, 2025
  5. Torsten BögershausenMay 10, 2025
  6. D. Ben KnobleMay 10, 2025
  7. Phillip WoodMay 12, 2025
  8. Mr BillMay 13, 2025

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.