I didn't know how forks and clones work. So in order to copy someone else's repo and work on it, I downloaded the repo's files (using no source control), created my own new repository, and then committed those files to it.
I want to pull request my repo's master to the original repo, but I can't because it's not a fork. Furthermore - git doesn't even know that they originate from the same source, and hence if I checkout the original repo, open a new fork, copy-paste all the files from my private repo to the new fork, and pull request it back in, it will show it as a single giant commit, and I'll lose all of the commit and comment history on the old repo, which will be terrible.
Is there a way for me to pull request my changes back into the original repo without losing all the history of my copied repo?
Once you've committed changes to your local copy of the repository, click the Create Pull Request icon. Check that the local branch and repository you're merging from, and the remote branch and repository you're merging into, are correct. Then give the pull request a title and a description. Click Create.
Forking creates a full copy of your repository, whereas branching only adds a branch to your exiting tree. The file size of branch can vary depending on the branch that you are on. Under the hood git readily accesses the different files and commits depending on what branch you are using.
The short answer for cloning a pull request is, you can't simply clone a pull request.
git status
and git diff
and commit them.unfortunately there is no way to merge two branches that dont have a common ancestor commit. even if the files are the same.
A very hacky workaround however goes as follows:
Its a laborious process, and you could probably create a tool to do it, but if its not a lot of commits, or you dont mind combining a few commits into one. (to do this, in step 3, just skip a couple of commits, the code from previous commits will still be there)
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