Can anyone explain what git cherry-pick does?

前端 未结 3 1857
误落风尘
误落风尘 2021-01-13 10:01

As my concern here is, I have old commit in my another local branch [contains abc.cpp, def.cpp].

Now after few months I want use those changes, but in my current bra

3条回答
  •  太阳男子
    2021-01-13 10:55

    Note that with git1.8.5/1.9 (Q4 2013), git cherry-pick can now easily cherry-pick "from the previous branch":

    Just like "git checkout -" knows to check out and "git merge -" knows to merge the branch you were previously on, "git cherry-pick" now understands "git cherry-pick -" to pick from the previous branch.

    See commit 182d7d from Hiroshige Umino (yaotti):

    cherry-pick: allow "-" as abbreviation of '@{-1}'

    "-" abbreviation is handy for "cherry-pick" like "checkout" and "merge".

    It's also good for uniformity that a "-" stands as the name of the previous branch where a branch name is accepted and it could not mean any other things like stdin.

提交回复
热议问题