There was a empty private repository(which I have access to it) on Github and I push my code into it . Now the owner asked me to empty the repository and send my code as a pull request. can anyone help me to empty repository and send my code as a pull request? thanks a lot for helping in advance.
I believe I had a similar question... "how do you make a pull request with a fresh new repository?" To do that, my idea is to create two local branches:
So then your question would be "for the empty branch, how do you overwrite the existing code"? Well, you can't. You can only have a remote repo if there's a commit in it. It can't truly be empty. To handle that, just create a single commit with an init. Later, you'll see that I rebase to build off the newly added initial commit.
Solution - This is how I do it assuming two things:
Command Instructions:
git checkout -b new # assuming "new" is your latest code for pull request to an empty repo
git branch -D master
git checkout -b master # create a fresh master
touch emptyfile; git add .; git commit -m "init commit"
git push origin master
git checkout new
git rebase master # If you're confused by what rebase does, try doing your own little research on it
git push origin new
You can now make a pull request from new into master! All you have to do is delete emptyfile after.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With