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
3.2k views
in Technique[技术] by (71.8m points)

git合并分支的某一次修改

有两个分支,比如一个是master,一个是dev,如果在dev分支修改提交了两次,提交的commit分别是“dev 第一次提交”,“dev第二次提交”,现在想把dev分支的第一次提交合并到master分支上去,没有mater权限,需要创建合并请求,请问各位大佬命令应该怎么写???

求大佬指点

如果有master权限我都是这么干的(合并某一次请求)

git log // 查看commit id
git checkout master // 切换到master分支
git cherry-pick [commit id]  // 合并某次修改到master

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

1 Answer

0 votes
by (71.8m points)
git log
git branch -f xxx [commit id] // 创建第一次提交的请求为xxx分支
然后把xxx分支提交出去,合并就好了

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

2.1m questions

2.1m answers

60 comments

57.0k users

...