1

I had a tag, at a very old revision of a repository. I have checked it out

   git checkout mytag

Now I am in detached HEAD state.

I have made some meaningful modifications. I would like to create a new branch mybranch_deviated locally and remotely, and commit all the meaningful changes to it. How to do that?

4

2 回答 2

6

With all of your code modifications you can simply create a new branch

git checkout -b mybranch_deviated

Then commit your changes

git add .
git commit -m 'some meaningful modifications'

And push the newly created branch to the server

git push -u origin branch_derivated
于 2018-12-10T07:00:55.070 回答
1

Just checkout a new branch from the current point:

git checkout -b mybranch_deviated

This should work whether or not you have already made some commits from the detached HEAD state. If you have, then those commits should be part of the new branch.

于 2018-12-10T06:56:55.923 回答