git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Wesley Schwengle <wesley@schwengle.net>
To: git@vger.kernel.org
Subject: Possible git bug
Date: Wed, 15 Sep 2021 23:29:14 -0400	[thread overview]
Message-ID: <30651e4d-10fb-8bc7-7f52-8fbabf042f4a@schwengle.net> (raw)


Hello,

I'm running into a weird issue with git at the moment and I'm wondering 
if this is a bug. I have a small reproduction path:

$ mkdir reproduction
$ cd reproduction
$ git init .
$ echo "commit a" > file.txt
$ git commit -m "First commit" file.txt
$ echo "commit b" >> file.txt
$ git commit -m "Second commit" file.txt

$ git switch -c foo
$ echo "commit c" >> file.txt"
$ git commit -m "Third commit" file.txt
$ git branch --set-upstream-to=master

$ git status
On branch foo
Your branch is ahead of 'master' by 1 commit.

$ git switch master
$ git merge foo
$ git reset --hard HEAD^
$ git switch foo
Switched to branch 'foo'
Your branch is ahead of 'master' by 1 commit.

$ git log --format='%C(yellow)%h%Creset %Cgreen%s%Creset'
5f427e3 Third commit
03ad791 Second commit
411e6d4 First commit

$ git rebase master
$ git status
On branch foo
Your branch is up to date with 'master'.

$ git log --format='%C(yellow)%h%Creset %Cgreen%s%Creset'
03ad791 Second commit
411e6d4 First commit

I do not expect to lose the commits from foo, it seems the ref of master 
doesn't get updated after a reset.

I didn't lose any work because I pushed my work to a remote and can 
still get it from there (and git reflog would also reach my code). It is 
rather surprising to see this kind of behavior.

I'm running:
$ git --version
git version 2.33.0.363.g4c719308ce

But I also got this behavior with the git shipped with Debian:
$ /usr/bin/git --version
git version 2.32.0

Cheers,
Wesley

-- 
Wesley Schwengle
E: wesley@schwengle.net

             reply	other threads:[~2021-09-16  3:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16  3:29 Wesley Schwengle [this message]
2021-09-16  5:37 ` Possible git bug Taylor Blau
2021-09-16 12:07   ` Wesley Schwengle
2021-09-16 12:47     ` wesley
2021-09-16 12:47       ` [PATCH] Document `rebase.forkpoint` in rebase man page wesley
2021-09-16 15:43         ` Junio C Hamano
2021-09-16 21:21           ` Junio C Hamano
2021-09-16 22:35             ` Possible git bug wesley
2021-09-16 22:35               ` [PATCH] Document `rebase.forkpoint` in rebase man page wesley
2021-09-16 22:47                 ` Junio C Hamano
2021-09-16 22:50                   ` Wesley Schwengle
2021-09-16 22:53                     ` Junio C Hamano
2021-09-20 14:34                       ` Wesley Schwengle
2021-09-16 22:46             ` Possible git bug wesley
2021-09-16 22:46               ` [PATCH] Document `rebase.forkpoint` in rebase man page wesley
2021-09-20 16:07                 ` Junio C Hamano
2021-09-16 15:33       ` Possible git bug Junio C Hamano
2021-09-16 19:39         ` Wesley Schwengle
2021-09-16 21:52           ` Junio C Hamano
2021-09-16 22:30             ` Wesley Schwengle
  -- strict thread matches above, loose matches on Subject: below --
2013-08-14  4:50 Hugh Davenport
2013-08-14  5:42 ` Daniel Knittl-Frank
2013-08-14  6:53   ` Jeff King
2009-01-17 13:52 Damon LaCrosse
2009-01-17 15:16 ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30651e4d-10fb-8bc7-7f52-8fbabf042f4a@schwengle.net \
    --to=wesley@schwengle.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).