[英]GIT how to put changes i made from master to dev branch?
So I forked a repo now I made changes to master branch and sent pull request, I made a mistake because they want the changes to be done in a different branch, the dev
branch. 因此,我分叉了一个仓库,现在我对master分支进行了更改并发送了pull请求,我犯了一个错误,因为他们希望在另一个分支
dev
分支中进行更改。
How do I put the changes from master to dev and send pull request again? 如何将更改从master转移到dev并再次发送请求请求?
assuming : 假设 :
Use some graphical tool to help you seeing if every thing goes well (gitk ; doing "shift F5" to refresh view , is a good option) 使用一些图形工具来帮助您查看是否一切顺利(gitk;执行“ shift F5”以刷新视图是一个不错的选择)
# on top of your dev : first create the dev branch
git checkout -b <dev-branch-name>
# then you must rewind where you would like master to be master
git checkout <sha 1 of position where master should be>
# at this point assign master head to here
git branch -f master
# now you have to push the two branches
# 1st dev branch
git push <remote-name> <dev-branch-name>
# then master note the -f force option
git push -f <remote-name> master
At each point you check in the graphical tool tool that it does what is expected 在每一点上,您都要检查图形工具是否完成了预期的工作
Why not use cherry-pick
? 为什么不使用
cherry-pick
?
I will assume that your current branch is master
. 我将假设您当前的分支是
master
。 If so, You check for the commit ID that you really want to commit to the dev
using git log
. 如果是这样,则使用
git log
检查您确实要提交给dev
人员的提交ID。 Then you see the commit logs like this: 然后,您会看到如下的提交日志:
commit ca82a6dff817ec66f44342007202690a93763949
Author: AuthorName < author@gee-mail.com>
Date: Mon Mar 17 21:52:11 2008 -0700
changed the version number
commit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
Author: AuthorName < author@gee-mail.com>
Date: Sat Mar 15 16:40:33 2008 -0700
removed unnecessary test code
If you want to apply the commit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
to the dev
. 如果要将提交
085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
到dev
。
and 和
git checkout dev
git cherry-pick 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
After that, you can send pull request again. 之后,您可以再次发送拉取请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.