I don't want to fork a project, but I would like to submit patches for inclusion; should I do this on the issue queue?
You should fork the project. In Github, this is very cheap. This way, you can push your changes how you want to your repository, and then make a pull request to have them included in the official repository.
You can then delete your fork after that.
If you don’t fork a project, that means:
you clone the original repo directly;
you cannot push directly back to it (because you are not declared as a contributor).
Then you can indeed use the issue queue to reference a patch.
If said patch isn’t too big, you can directly copy/paste its textual form.
If not, you can copy it to some pastebin site and link it from your issue ticket.
Related
I would like to provide a URL to a subfolder of a GitHub repo in a paper I am about to submit. I thought the link should look like github.com/account/reponame/folder/subfolder, but I realised now that when navigating through the repo, I need to write github.com/account/reponame/tree/main/folder/subfolder for the link to work. Can I assume a link with this format to be persistent, or is there a better way of ensuring that the URL is useful for a long time?
the /tree/master/ just indicates the master branch is being accessed. The link would be active till someone with edit access to the repo changes the folder structure or deletes it. If it is a repo with shared edit access, I would suggest you to fork it and make it private and then share the link from the fork so that no one would make changes to the path other than you.
It is safer to refer to a specific commit, that is:
github.com/account/reponame/tree/COMMITID/main/folder/subfolder
Where COMMITID is the SHA hash of your commit, which should look like 56e05fced214c44a37759efa2dfc25a65d8ae98d
That way, you can still push changes to your repo, and the reviewers still will get access to the specific version you want.
Bitbucket has a feature to exclude files from the new pull request and I'm wondering if there is a similar feature in GitHub?
Scenario:
I have a Branch A that has changes in .travis.yml I pushed those
changes and create a PR I need to merge all changes in this branch
except the changes in .travis.yml file.
No, there is no such feature in GitHub (to the best of my knowledge confirmed by a quick google search).
The best alternative, excluding the proposed duplicate question for using a workaround, is to refer to this blog page, stating that:
Previously, if you wanted to use GitHub to remove files from a pull
request, you’d need to switch to the pull request branch and look for
the individual file to delete it. Now, if you have write permission,
you can click on the ‘trash’ icon for a file right in the pull
request’s “Files changed” view to make a commit and remove it.
I haven't tested this method, but I feel like it is somehow related to the rejected "alternative workaround".
I am newbie in GitHub. I wonder why the option "Fork" is there when I have the option of cloning others' project and make my own repository on GitHub to extend it?
I guess the best answer I can think of is you might want to bring the fork back into the original branch, hence keeping it in the same repository.
I believe Forks were designed for playing with ideas or for suggesting changes to the owner of the repository, heres a link about it:
Github Forks
Yes, you are right, you can clone another repo and do any desired stuff.
But after that you need merge your updates into original repo (share your improvements with whole world) - and exactly for this purposes you need fork.
As far as I know, only this is the most flexible way manage your updates with original repo. And only this way can avoid undesired commit into original repo (repo owner able manage all propositions about any changes).
I've previously forked jockm/vert.x and sent him a pull request. Now I want to fork vert-x/vert.x (the upstream of jockm/vert.x) and send them a different pull request. But when I click the Fork button, unsuprisingly I end up in my tjcrowder/vert.x fork of jockm/vert.x instead. Is it possible to fork both vert-x/vert.x and jockm/vert.x simultaneously such that I can send each pull requests as appropriate?
I fear the answer may be the same as for this question about the converse situation ("there's no GitHub way, but you can add a remote repo") but I'm hoping otherwise — not least because I don't see how the answer there would allow me to send pull requests to the new remote.
There's no GitHub way (small lie, see below), but there's also nothing to fear.
By definition, your fork of a fork is a fork of the original.
When you open a pull request, you get the option to choose both the origin and the destination for your pull request. The choices available there obviously depend on the fork graph, but as long as there is a path in the graph between the 2 repositories, you should be safe.
Also, since pull requests live on the website side, you don't even need to add a remote as long as you don't want to use it from git.
Now of course, you might want to reconsider your place in that graph, and make yourself a direct child of the real upstream, but that's mostly unrelated.
As said earlier there is actually a twisted way to have multiple forks, which is to create organizations and fork in them. That way you can "own" multiple repositories in the same graph. But there's really no need to go there.
Thanks to sigma's answer, I saw that not only is the upstream repo available when I go to do a pull request on the jockm/vert.x repo, but all other forks of the upstream repo are as well. So what I ended up doing was:
Deleting my fork of jockm/vert.x and instead forking vert-x/vert.x, since mostly I want to work within the main upstream repo, not jockm's version.
Creating a branch for the commit I wanted to send to jockm, and a separate branch for the commit I wanted to send to vert-x.
Making the relevant changes to each branch.
Sending pull requests for each branch to the relevant repos, since the jockm/vert.x repo is listed as a possible target for the request (along with about 200 other forks).
I used separate branches (basically topic branches) so that those commits would remain the only thing in those pull requests, since subsequent commits on the same branch are automatically added to the pull request, and these changes needed to remain isolated until/unless merged.
It seems like the better option would be to create a branch on your fork, and create a pull request from that branch. You can use branches to "fork" your version
I didn't see any specifics on "multiple forks", so I would probably end up creating another GitHub account, under which I would do the second clone, and send the different pull request to vert.x/vert.x.
Since you can have "Multiple github accounts on the same computer" (with the right ssh config file, also described here), it is a possible workaround.
Note that, however, this is supported by GitLab, with GitLab 14.0 (June 2021):
Edit default path and project name when forking
Edit default path and project name when forking
Forking a project enables you to have an exact copy of an original repository where you can experiment, apply changes, and submit contributions to the parent project.
Your forks should have meaningful names that explain their goals, and if your project is diverging, you may need multiple forks of a single project.
In this release, GitLab now supports editing the project name and project slug directly when you create a fork.
You can now create multiple forks of the same project, each with a different name, all in the same group!
See Documentation and Issue.
You could also just create a new Organization under your profile/settings. Then you can fork different states of the same original repo through the same account.
I just started using github.com and my friend and I are working on a project. How can I pull parts of the project but check out certain files I'm working on so he doesn't work on them. He can still download the files but he won't be able to open or edit them until I upload them back and give permission?
I suppose you mean lock a file when you edit it. Git won't let you do this and it's not something you need to worry about. Instead, you can both work on the same file and then merge your changes later.
If you really want to work that way (i.e: lock files, or at least control when your friend will modify your repo), you can ask your friend to fork your repo.
That way, he/she:
will have his/her own copy of said repo
will work on any file
will rebase first with branches fetched from your repo (added as a remote on his/her fork, as described in GitHub: working with remotes)
will make pull request, allowing to decide what to include and when.
Historically version control systems provide a checkin/checkout feature. When you do a checkout, you reserve the artifact. If another person also has the same file checked out, then you get an error when trying to checkin the artifact. Not sure creating another fork is really the equivale