How to do a pull request when my branch and master have no related history?
This is easily doable by doing the following:
Checkout
branch_x
to work on it:git checkout branch_x
Reset soft to
master
so thatbranch_x
is now at the same place thanmaster
in the git history but all your changes are now staged (reset --soft
doesn't touch files in the working directory and even add the changes directly to the staging area):git reset --soft master
Commit the files so that it will create one commit containing just the changes made in
branch_x
compared tomaster
git commit
And now branch_x
is one commit ahead of master
and you can create your PR. You perhaps will have to push --force
depending if you already pushed branch_x
I found this to work, do your normal flow from the branch_x
that you want to push up.
git add .
git commit -m "message"
git pull origin master(or whatever branch) --allow-unrelated-histories
git push origin branch_x
you should now be able to compare and PR