I'm getting a bit confused with Git!
- I cloned a repo on GitHub to a local drive.
- I made some changes and committed to my local repo
- At this point, I couldn't figure out how to clone my local repo to a new GitHub repo, so I went to GitHub.com and created a new repo with their web interface
- I then did a
git-push MyNewRepoOnGitHub master
Does MyN开发者_开发知识库ewRepoOnGitHub
have everything that I originally cloned? Can I send a pull request to the contributors of the project that I originally cloned? Or... am I being completely thick and need to reread what I thought I knew about Git?!
Your new repository on github will only contain all commits reachable from master
(you only pushed master). To push all refs (including tags), use git push MyNewRepoOnGitHub --all
.
I don't use github myself, but a pull request should be possible. Commits don't change when cloned or pushed (but it could be possible that github requires you to 'fork' the project first). Pulling and merging from your both your cloned repositories will definitely work (with plain git)
I think you will have to explicitly "fork" the original repo to raise a pull request. Github currently doesn't know that your MyNewRepoOnGitHub
is related to the original repo you cloned from. Forking establishes this relation and allows for pull requests to be raised to share commits.
You can:
- Fork the original repo from which you cloned
Setup the forked repo as an additional remote repository (for the existing cloned repo on your machine)
git remote add MyForkedRepo <url-to-your-forked-repo>
Push your changes to the forked repo
git push MyForkedRepo master
Raise a pull request on Github
Without forking there are two ways, albeit very ancient looking compared to the pull request approach,
- The original repo commiter/owner will have to add your
MyNewRepoOnGithub
as his remote and pull your changes and merge them and push them the original repo - You email the original repo owner a patch and he applies and commits to the repo on your behalf
精彩评论