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

[BUG] rebase no longer omits local commits

From
Ted Felix <ted@tedfelix.com>
Date
Jul 3, 2014, 15:14 UTC
Message-ID
<53B57352.50202@tedfelix.com>

Starting with git 1.9.0, rebase no longer omits local commits that appear in both the upstream and local branches.

I've bisected this down to commit bb3f458: "rebase: fix fork-point with zero arguments". The attached script reproduces the problem. Reverting the aforementioned commit fixes the problem.

A failed run of this script will result in conflicts. A successful run against master with bb3f458 reverted ends as follows:

 From /tmp/rebase-issue/maint
    fe401cd..955af04  master     -> origin/master
fatal: Not a valid object name: ''
First, rewinding head to replay your work on top of it...
Applying: Third change

(I'm not sure if that "fatal: Not a valid object name: ''" is of any concern. It started appearing for me at some point during the bisect.)

Let me know if there's more I can do to help.
#!/bin/bash

# git-rebase is supposed to drop commits that it finds in both the # local and upstream branches. As of 1.9.0, this isn't happening. # This script reproduces the problem.

# I've bisected the issue down to commit bb3f458. Reverting that commit # solves the problem.

# Run this in a directory where you have create privs. # At the end, if there are conflicts, then the test has failed.

# Create a repo. mkdir rebase-issue cd rebase-issue mkdir maint cd maint git init

# Create a README file and put some text in it echo "Hi there!" >README git add README git commit -a -m "Initial commit"

# Clone the repo for "dev" cd .. git clone maint dev

# Dev makes *two* changes to the *same* area. cd dev # edit something, make some typos echo "Freekwently Mispeled Werdz" >README git commit -a -m "First change" # edit same thing, fix those typos echo "Frequently Misspelled Words" >README git commit -a -m "Second change"

# Create patches to send to maintainer... git format-patch -M origin/master mv *.patch ../maint

# Add a third change that should make it through for completeness. echo "Frequently Misspelled Words version 2" >README git commit -a -m "Third change"

# We have to sleep (to make sure the times do not match?). # If we don't, this script will succeed on fast machines. # This can probably be reduced to 2 which should guarantee that # the seconds will turn over on the clock. echo echo "Waiting 5 seconds to make sure apply time is different from patch time..." sleep 5

echo echo "Maint applies patches..." cd ../maint git am -3 *.patch

echo echo "Dev does the fetch/rebase..." cd ../dev git fetch git rebase

echo git --version

Next: John Keeping
Message 1 of 15 in “[BUG] rebase no longer omits local commits”
  1. Ted FelixJul 3, 2014
  2. John KeepingJul 3, 2014
  3. John KeepingJul 3, 2014
  4. Junio C HamanoJul 7, 2014
  5. John KeepingJul 7, 2014
  6. 1/2 rebase--am: use --cherry-pick instead of --ignore-if-in-upstreamJohn Keeping, Jul 15, 2014
  7. 2/2 rebase: omit patch-identical commits with --fork-pointJohn Keeping, Jul 15, 2014
  8. Ted FelixJul 15, 2014
  9. Junio C HamanoJul 15, 2014
  10. 1/2 rebase--am: use --cherry-pick instead of --ignore-if-in-upstreamJohn Keeping, Jul 16, 2014
  11. 2/2 rebase: omit patch-identical commits with --fork-pointJohn Keeping, Jul 16, 2014
  12. Junio C HamanoJul 16, 2014
  13. John KeepingJul 16, 2014
  14. Ted FelixJul 16, 2014
  15. John KeepingJul 17, 2014

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.