Bug in git rebase -i where <upstream> is "HEAD" in 1.5.4?

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

 



Hi all-
I've discovered a difference in behavior between `git rebase` and `git rebase -i`, and I believe the behavior exhibited by `git rebase - i` is incorrect and should be changed to match `git rebase`. The behavior difference occurs when running the command in the form:

git rebase [-i] <upstream> <branch>

If <upstream> is "HEAD", `git rebase` seems to perform these (correct) steps:

A=$(git rev-parse HEAD)
git checkout <branch>
git rebase $A

   However, `git rebase -i` seems to perform these (incorrect) steps:

git checkout <branch>
git rebase -i HEAD

The problem is that `git checkout` changes the meaning of HEAD (naturally), and so these steps are not equivalent. The end result is that `git rebase -i HEAD <branch>` just checks out <branch> and prints "Nothing to do", while when -i is omitted the rebase occurs as expected. Below is a transcript that shows exactly what I mean.

-Adam


% git init
Initialized empty Git repository in .git/
% touch onmaster
% git add onmaster
% git commit -m "Added onmaster"
Created initial commit 7c3e0f1: Added onmaster
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 onmaster
% touch onmaster2
% git add onmaster2
% git commit -m "Added onmaster2"
Created commit c19019b: Added onmaster2
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 onmaster2
% git checkout -b work HEAD^
Switched to a new branch "work"
% touch onwork
% git add onwork
% git commit -m "Added onwork"
Created commit ae14495: Added onwork
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 onwork
% touch onwork2
% git add onwork2
% git commit -m "Added onwork2"
Created commit 64b3dc0: Added onwork2
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 onwork2
% ls
onmaster onwork   onwork2
% git checkout master
Switched to branch "master"
% ls
onmaster  onmaster2
% git rebase -i HEAD work
Nothing to do
% ls
onmaster onwork   onwork2

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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