rebase update-refs can delete ref branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
$ git init
Initialized empty Git repository in /home/emusser/git/test/.git/
$ git checkout -b working-branch
Switched to a new branch 'working-branch'
$ git commit -m "commit 1" --allow-empty
[working-branch (root-commit) 1238cf8] commit 1
$ git commit -m "commit 2" --allow-empty
[working-branch 2dd4408] commit 2
$ git branch other-branch
$ git commit -m "commit 3" --allow-empty
[working-branch 39f626e] commit 3
$ git rebase -i --update-refs HEAD~2
[I am presented]:
pick 2dd4408 commit 2 # empty
update-ref other-branch

pick 39f626e commit 3 # empty

[I deleted first two lines and submitted]:
pick 39f626e commit 3 # empty

Successfully rebased and updated refs/heads/working-branch.
Updated the following refs with --update-refs:
refs/heads/other-branch
$ git rev-parse other-branch
other-branch
fatal: ambiguous argument 'other-branch': unknown revision or path not
in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

What did you expect to happen? (Expected behavior)
The branch I interactively removed from the rebase to not actually be
deleted. It is common
to remove unrelated changes (and refs) from your working branch before pushing.
I'd hope in this case I would not have to use `git rebase
--no-update-refs' (if I'm set
in my config UpdateRefs=true) to avoid branches from being deleted.

What happened instead? (Actual behavior)
The branch was deleted.

What's different between what you expected and what actually happened?
The branch was deleted when I would expect branches that are no longer listed
to not be updated or deleted.

Anything else you want to add:

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.38.0
cpu: aarch64
built from commit: 3dcec76d9df911ed8321007b1d197c1a206dc164
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.16.13-generic #2 SMP Fri Mar 11 12:48:38 UTC 2022 aarch64
compiler info: gnuc: 10.2
libc info: glibc: 2.17
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]
pre-commit



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux