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

git pull --rebase silently skipping commits

From
AMAlejandro Colomar (man-pages) <alx.manpages@gmail.com>
Date
Apr 24, 2021, 13:46 UTC
Message-ID
<17e490f6-c393-0232-3236-3c1758b8bd25@gmail.com>
Hello,

I started my PC and as always did a 'git fetch'. I noticed that I forgot to push a commit the other day, so I had the following situation:

alx@msi:~/src/alx/config$ git tree -8
* 226e73c - Thu, 22 Apr 2021 22:28:37 +0200 (2 days ago) (tag: v0.8.0, 
origin/main, origin/HEAD)
|           Makefile: ffix - Alejandro Colomar
* 29cac15 - Thu, 22 Apr 2021 22:21:56 +0200 (2 days ago)
|           Makefile: remove unused option of read - Alejandro Colomar
* 5adc827 - Thu, 22 Apr 2021 22:20:16 +0200 (2 days ago)
|           Makefile: use INSTALL_DATA instead of plain install - 
Alejandro Colomar
* 28df09e - Thu, 22 Apr 2021 22:12:40 +0200 (2 days ago)
|           Makefile: Don't hardcode things - Alejandro Colomar
* 9cdb873 - Thu, 22 Apr 2021 22:11:32 +0200 (2 days ago)
|           ssh: Simplify code, and don't overwrite other contents of 
.ssh/config - Alejandro Colomar
| * 4d2f5ad - Thu, 22 Apr 2021 19:22:16 +0200 (2 days ago) (HEAD -> main)
|/            sudo: Rename user alex to alx - Alejandro Colomar
* ad1d205 - Thu, 22 Apr 2021 12:51:10 +0200 (2 days ago) (tag: v0.7.0)
|           hosts: Don't overwrite the hole file - Alejandro Colomar
* c5137b5 - Wed, 21 Apr 2021 14:14:34 +0200 (3 days ago) (tag: v0.6.2)
|           Makefile: ffix - Alejandro Colomar
alx@msi:~/src/alx/config$

Normally I would've run 'git rebase origin/main', but recently I knew about 'git pull --rebase', so I was tried it. However, to my surprise, it silently skipped the local commit:

alx@msi:~/src/alx/config$ git pull --rebase
Successfully rebased and updated refs/heads/main.
alx@msi:~/src/alx/config$ git tree -8
* 226e73c - Thu, 22 Apr 2021 22:28:37 +0200 (2 days ago) (HEAD -> main, 
tag: v0.8.0, origin/main, origin/HEAD)
|           Makefile: ffix - Alejandro Colomar
* 29cac15 - Thu, 22 Apr 2021 22:21:56 +0200 (2 days ago)
|           Makefile: remove unused option of read - Alejandro Colomar
* 5adc827 - Thu, 22 Apr 2021 22:20:16 +0200 (2 days ago)
|           Makefile: use INSTALL_DATA instead of plain install - 
Alejandro Colomar
* 28df09e - Thu, 22 Apr 2021 22:12:40 +0200 (2 days ago)
|           Makefile: Don't hardcode things - Alejandro Colomar
* 9cdb873 - Thu, 22 Apr 2021 22:11:32 +0200 (2 days ago)
|           ssh: Simplify code, and don't overwrite other contents of 
.ssh/config - Alejandro Colomar
* ad1d205 - Thu, 22 Apr 2021 12:51:10 +0200 (2 days ago) (tag: v0.7.0)
|           hosts: Don't overwrite the hole file - Alejandro Colomar
* c5137b5 - Wed, 21 Apr 2021 14:14:34 +0200 (3 days ago) (tag: v0.6.2)
|           Makefile: ffix - Alejandro Colomar
* 5244a5c - Wed, 21 Apr 2021 14:12:05 +0200 (3 days ago) (tag: v0.6.1)
|           sshd: restart service after installing - Alejandro Colomar
alx@msi:~/src/alx/config$
When trying 'git pull --rebase=interactive', I see the following:
noop 
 
# Rebase 4d2f5ad..4d2f5ad onto 226e73c (1 command)

I'd expect 'git pull --rebase' to be an equivalent of 'git fetch origin && git rebase origin/main'. But this time I had to use rebase:

alx@msi:~/src/alx/config$ git reset 4d2f --h
HEAD is now at 4d2f5ad sudo: Rename user alex to alx
alx@msi:~/src/alx/config$ git tree -8
* 226e73c - Thu, 22 Apr 2021 22:28:37 +0200 (2 days ago) (tag: v0.8.0, 
origin/main, origin/HEAD)
|           Makefile: ffix - Alejandro Colomar
* 29cac15 - Thu, 22 Apr 2021 22:21:56 +0200 (2 days ago)
|           Makefile: remove unused option of read - Alejandro Colomar
* 5adc827 - Thu, 22 Apr 2021 22:20:16 +0200 (2 days ago)
|           Makefile: use INSTALL_DATA instead of plain install - 
Alejandro Colomar
* 28df09e - Thu, 22 Apr 2021 22:12:40 +0200 (2 days ago)
|           Makefile: Don't hardcode things - Alejandro Colomar
* 9cdb873 - Thu, 22 Apr 2021 22:11:32 +0200 (2 days ago)
|           ssh: Simplify code, and don't overwrite other contents of 
.ssh/config - Alejandro Colomar
| * 4d2f5ad - Thu, 22 Apr 2021 19:22:16 +0200 (2 days ago) (HEAD -> main)
|/            sudo: Rename user alex to alx - Alejandro Colomar
* ad1d205 - Thu, 22 Apr 2021 12:51:10 +0200 (2 days ago) (tag: v0.7.0)
|           hosts: Don't overwrite the hole file - Alejandro Colomar
* c5137b5 - Wed, 21 Apr 2021 14:14:34 +0200 (3 days ago) (tag: v0.6.2)
|           Makefile: ffix - Alejandro Colomar
alx@msi:~/src/alx/config$ git rebase origin/main
Successfully rebased and updated refs/heads/main.
alx@msi:~/src/alx/config$ git tree -8
* 72f6ab9 - Thu, 22 Apr 2021 19:22:16 +0200 (2 days ago) (HEAD -> main)
|           sudo: Rename user alex to alx - Alejandro Colomar
* 226e73c - Thu, 22 Apr 2021 22:28:37 +0200 (2 days ago) (tag: v0.8.0, 
origin/main, origin/HEAD)
|           Makefile: ffix - Alejandro Colomar
* 29cac15 - Thu, 22 Apr 2021 22:21:56 +0200 (2 days ago)
|           Makefile: remove unused option of read - Alejandro Colomar
* 5adc827 - Thu, 22 Apr 2021 22:20:16 +0200 (2 days ago)
|           Makefile: use INSTALL_DATA instead of plain install - 
Alejandro Colomar
* 28df09e - Thu, 22 Apr 2021 22:12:40 +0200 (2 days ago)
|           Makefile: Don't hardcode things - Alejandro Colomar
* 9cdb873 - Thu, 22 Apr 2021 22:11:32 +0200 (2 days ago)
|           ssh: Simplify code, and don't overwrite other contents of 
.ssh/config - Alejandro Colomar
* ad1d205 - Thu, 22 Apr 2021 12:51:10 +0200 (2 days ago) (tag: v0.7.0)
|           hosts: Don't overwrite the hole file - Alejandro Colomar
* c5137b5 - Wed, 21 Apr 2021 14:14:34 +0200 (3 days ago) (tag: v0.6.2)
|           Makefile: ffix - Alejandro Colomar
alx@msi:~/src/alx/config$
I wonder if it may be due to this text, which I don't really understand:
alx@msi:~$ man git-pull | sed -n '/-r, --rebase/,/^$/p'
        -r, --rebase[=false|true|merges|preserve|interactive]
            When true, rebase the current branch on top of the
            upstream branch after fetching. If there is a
            remote-tracking branch corresponding to the upstream
            branch and the upstream branch was rebased since last
            fetched, the rebase uses that information to avoid
            rebasing non-local changes.

What does it mean "the upstream branch was rebased since last fetched"? May it be the reason that it skipped that commit? Isn't 'git pull --rebase' designed for what I'm using it? In this case it's not really necessary, but it removes the need for specifying the branch I'm on, which is why I preferred it over 'git rebase'.

Thanks,
Alex
-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
Senior SW Engineer; http://www.alejandro-colomar.es/
Message 1 of 1 in “git pull --rebase silently skipping commits”
  1. Alejandro Colomar (man-pages)Apr 24, 2021

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.