I have a local repository that is a full copy of a repository on github. I made a change that I would like to contribute to the original project.
How can I do this without reloading my project on github? I don't think opening an issue is the right way..
I saw in How can I contribute a patch to github? that I should fork the project, but since my local repository is "linked" to the original github repository, I don't want to mess it up.
So, if it is really discouraged to share the patch in any way but fork, how can I simply fork the original project, merge my changes, and then share them with the original repository?
If I delete the fork after I "committed" the change (but it isn't accepted yet), does my commit disappear?
You should fork the project, yes. However, this does not mean you need to clone the whole stuff again locally.
Explanation: a simple way of looking at a git repository is a graph of commits (it is directed and acyclic but that is irrelevant for this discussion); and all nodes of this graph, ie the commits, have a unique identifier across all git repositories in the world. As to branches, they are just symbolic references to a commit (in git parlance, a branch -- or a tag -- is called a refspec).
Also, you are never linked to a remote repository in any way. The only thing you are really "linked to" is the commit graph. A remote repository just happens to have a set of refspecs (branches, tags)... pointing to a commit graph, which they also have -- nobody likes dangling references. When you clone a repository, you get the commit graph (and associated trees) and the set of refspecs (ie branches, tags). A refspec points to a tree. And that's about it.
This means the following:
OK, now do the following:
originby default. And what now?
Adding your fork as a remote is as "simple" as:
git remote add myfork firstname.lastname@example.org:youruser/theproject
Push your refspec (branch) to it:
git push myfork mybranch
And then submit a pull request to the original author.
It should be noted that in theory, you can add a remote to a git repository which has no relevance at all with the "original" repo: this is simply that the two commit graphs will be completely disjoint from one another -- however, the use cases for this are rare