[Development] Seeking advise using git and code review
Edward Welbourne
edward.welbourne at qt.io
Wed Oct 4 11:17:03 CEST 2017
Daniel Savi:
>> When checking the branch with "git branch", I found that I was on a
>> detached head now.
André Hartmann (4 October 2017 09:25)
> That sounds like you didn't work on a local branch, but rather on the
> remote branch. When commiting there, you go into detached head. But
> that's no problem, it just needs special handling.
e.g. the git checkout -b name-of-your-choice, as an earlier response said.
>> I couldn't go back to the branch, because git told me that I would
>> lose my changes.
> Then you most likely have uncommited changes there. What does
>
> git status
>
> say?
This needn't be uncommitted changes: when in detached HEAD state,
switching to a branch will leave behind the detached HEAD with no
reference to it, so that the next git gc will wipe it out. So doing the
suggested git checkout -b should make git more relaxed about letting you
git checkout some other branch.
Eddy.
More information about the Development
mailing list