2

I am using git version 2.9.0.windows.1 and I want to rebase a local repository (no remote). But I always get

There is no tracking information for the current branch. Please specify which branch you want to rebase against. See git-rebase(1) for details.

git rebase

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=/ master

I tried git rebase -i HEAD~3 as suggested in this solution, but it doesn't work in my case.

If I simply copy the repository to my Linux machine, git rebase works fine. I checked with git config --list on both machines, they seem almost the same.

So I am wondering what makes git rebase doesn't work on my Windows machine.

UPDATE I did a test for a small case, see my history: git history and rebase: git rebase message

No matter what option I use with git rebase, I got the same message

Community
  • 1
  • 1
NAX
  • 139
  • 1
  • 7
  • "it doesn't work": what error message do you see? – VonC Jun 17 '16 at 07:14
  • @VonC message `There is no tracking information for the current branch. Please specify which branch you want to rebase against. See git-rebase(1) for details...`, like I posted. There is no editor popup which allows me to change the commit history. – NAX Jun 17 '16 at 07:24
  • It sure looks like you've hit a bug in this particular leading-edge (bleeding-edge) version of Git. – torek Jun 17 '16 at 07:52
  • @torek Actually no: that but was seen as soon as git-for-windows 2.7.0 (January 2016) – VonC Jun 17 '16 at 09:39
  • I see: not a bug in Git per se, and not all that new, some sort of weird interaction causing problems with a (the?) Windows port of bash. – torek Jun 17 '16 at 20:16

1 Answers1

2

git rebase -i HEAD~3 should work unless:

  • you are in a branch which has not 3 commits (but only 2 or one since the first commit),
  • you are not in a branch (detached HEAD: check with git branch -vv)
  • you are affected by issue 704 and issue 710

I added bash.exe to MacType utility exclusion list, now all is good.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for you answer, but I don't think that is the reason. I updated the question with pictures of git history and rebase message: the branch has 3 commits and HEAD is at the tip of the branch – NAX Jun 17 '16 at 07:44
  • @NAX Do you have the same error with `git rebase -i @~3 @` or `git rebase -i @~3 branch`? (`@` is a shortcut for `HEAD`) – VonC Jun 17 '16 at 07:47
  • @NAX Do you have the same error in a regular CMD session (not git-bash)? – VonC Jun 17 '16 at 07:47
  • @NAX in a CMD as well? – VonC Jun 17 '16 at 07:52
  • @NAX I have seen bugs affecting git bash, and edited the answer to reference them. – VonC Jun 17 '16 at 07:59
  • Try to unzip the portable git distribution (no setup) in a simple path without spaces, and try to set your PATH, still in a CMS session, to a minimum. Then try again. – VonC Jun 17 '16 at 08:23
  • @ VonC amazingly... I don't know what happened, but you are right... if I quit MacType, git rebase just works fine. Anyway I think if I put bash.exe to the exclusion list, should also good. Thanks! – NAX Jun 17 '16 at 08:35
  • Note to self: https://www.bountysource.com/issues/32194151-git-rebase-fails-for-branches-that-lack-the-tracking-information-even-when-the-upstream-branch-is-explicitly-provided – VonC Oct 16 '17 at 06:17