All of lore.kernel.org
 help / color / mirror / Atom feed
* Possible git bug
@ 2021-09-16  3:29 Wesley Schwengle
  2021-09-16  5:37 ` Taylor Blau
  0 siblings, 1 reply; 20+ messages in thread
From: Wesley Schwengle @ 2021-09-16  3:29 UTC (permalink / raw)
  To: git


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

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2021-09-20 16:07 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16  3:29 Possible git bug Wesley Schwengle
2021-09-16  5:37 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.