Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
834 views
in Technique[技术] by (71.8m points)

git cherry-pick to another branch

I wonder if there is the way to copy one commit to another branch without checking out that branch.

For example, I have two branches: master and parallel_version.

I'm on parallel_version branch and I found a bug in file common for these branches.

I've fixed it and committed. How to duplicate this commit to another branch, assuming I'm using git-svn?

Normally I would do:

$ git checkout master
$ git cherry-pick parallel_version
$ git checkout parallel_version

Is there better way of doing that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

That's not possible - simply imagine what would happen if there was a conflict that couldn't be resolved automatically. For the same reason you also can't update branches that are not currently checked-out (even if a fast-forward was possible).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...