开发者

git merging local branch with remote branch

I have a remote git repository where I have a tag (tag-1) that is several commits back from master. I'm trying to take the very last commit (6337dcb1) and add that to an updated tag-1, creating a new tag called tag-2. I'm pretty new to git so I'm getting confused about the process that I'm trying to piece together.

So far I have cloned the remote repository and performed a:

git checkout tag-1

which gives me the following message:

Note: checking out 'tag-1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another check开发者_如何学运维out.

So far so good?

After this, I am trying to cherry-pick the latest commit (6337dcb1) with

git cherry-pick 6337dcb1

Ok, so after this I'm not sure how to proceed. It says that I'm not currently on any branch so I might have messed up when checking out the tag.

Do I simply commit the files and apply a new tag or is there something else I'm supposed to do here? I'm fairly new to git and have only been dealing with pushes, pulls and merges so far so any help in understanding this would be greatly appreciated.


Instead of doing

git checkout tag-1

create a new branch to work on based on tag-1 using:

git checkout -b branch-1 tag-1

After you have made the commit(s) you want, do

git tag tag-2
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜