2013-01-05 32 views
0

我有两个分支,即master和development。 我只需从开发 分支中挑选一些特定的提交,并将它们合并到主设备上。Git:关于cherrypick的查询在Git中提交

我试图用git cherry-pick,但不知道如果我正确的方式做

我是否需要樱桃采摘a400452d64 OR a7644fc2bc7b09fe88cb1cbb75e0547dd1d7321d 请参阅图像

enter image description here

我按照下面的方法。

git checkout master 

git pull 

git cherry-pick a400452d64

OR

git cherry-pick a7644fc2bc7b09fe88cb1cbb75e0547dd1d7321d 

git commit -m "My Commit" # Is this necessary ?? 

git push -u origin master # Is this necessary ?? 

请让我知道,如果我做错了什么?

回答

1

“父”提交是那个提交之前的提交,所以'提交'散列是你想要使用的。为免生疑问,你可以这样做:

git show a7644fc2bc7b09fe88cb1cbb75e0547dd1d7321d 

,并检查它的右提交你收到:

git checkout master 
git pull 
git cherry-pick a7644fc2bc7b09fe88cb1cbb75e0547dd1d7321d 
git push 

指定上推的起源可能不是必要的,如果上游的配置是否正确。

+0

非常感谢,这是非常好的解释。 – Pawan