Rebase problem in GIT Bash

477 views
Skip to first unread message

Ảnh Viện Wednesday

unread,
Jun 22, 2017, 10:47:40 PM6/22/17
to Repo and Gerrit Discussion
Dear Admins,

I have a problem when you im using resolve a conflict after push review to Gerrit.
These are my steps:

# update from remote
$ git fetch
 
# get my change from gerrit
$ git fetch ssh://hoang.nth@localhost:29418/Git_training_class2 refs/changes/25/325/1 && git checkout FETCH_HEAD
# git rebase and problem
$ git rebase origin/master
You are not currently on a branch.
Please specify which branch you want to rebase against.
See git-rebase(1) for details.
    git rebase <branch>
 
D:\SVMC-Testing-Project>git branch
* (HEAD detached at FETCH_HEAD)
  master
D:\SVMC-Testing-Project>git --version
git version 2.9.3.windows.1


In only happened in Git bash, but when i used linux environment, it was okay.

So in this case, how can i fixed this problem in window, cauze alot of our developers are using window.

Best Regards,

Magnus Bäck

unread,
Jun 26, 2017, 2:14:50 AM6/26/17
to Ảnh Viện Wednesday, Repo and Gerrit Discussion
On Friday, June 23, 2017 at 04:47 CEST,
As the error message indicates the problem is that you're not on a
branch. This is because you checked out FETCH_HEAD and ended up on
a detached head (as you can see from the "git branch" command).
Create a branch where you stand with e.g. "git branch my-rebase"
and you should be fine.

If this worked on Linux it might be because you're using different
versions of Git and one is less restrictive than the other.

--
Magnus Bäck | Software Engineer, Development Tools
magnu...@axis.com | Axis Communications

Ảnh Viện Wednesday

unread,
Jun 26, 2017, 10:20:27 PM6/26/17
to Repo and Gerrit Discussion, hoangn...@gmail.com

Dear Mr Magnus,

I already tried as your guidance, but when i created a new branch, and rebased it. Git asked me to set the new branch as upstream branch.


$git branch rebase
$git checkout rebase
Switched to branch 'rebase'
A       lol.txt
$git rebase origin/master
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 <branch>
If you wish to set tracking information for this branch you can do so with:
    git branch --set-upstream-to=origin/<branch> rebase


And this is my git window version:

$git --version
git version 2.13.1.windows.2


Best Regards,
Vào 13:14:50 UTC+7 Thứ Hai, ngày 26 tháng 6 năm 2017, Magnus Bäck đã viết:
Reply all
Reply to author
Forward
0 new messages