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.
How do I put the changes from master to dev and send pull request again?
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.
How do I put the changes from master to dev and send pull request again?
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)
# 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
?
I will assume that your current branch is master
. If so, You check for the commit ID that you really want to commit to the dev
using git log
. 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
.
and
git checkout dev
git cherry-pick 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
After that, you can send pull request again.