How to make changes to an environment installed from a repo? #22126
-
Hi, I need to utilise code that I am allowed to install from a particular repo. What are the correct steps to install it, make the necessary changes + additions, and then push it to my own github account ? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
If I’ve understood correctly, you’re asking about GitHub’s “Fork and Pull Request” model, which is the workflow adopted by GitHub to collaborate to repositories created by others. You might find a good introductory article at this link: reflectoring.io – 2 Jan 17Github's Fork & Pull Workflow for Git BeginnersIf you are new to Git and/or GitHub, it's easy to get overwhelmed by the different workflow models you can use. This post explains the basic fork and pull workflow model that is used on a lot of GitHub repositories. The article will provide you with a bird-eye view of the whole process, for the practical details of all the operations involved you’ll find topic-dedicated tutorials on GitHub Help: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/github-flow If you’re new to Git and GitHub, you might consider working with GitHub Desktop, the free and open source GUI Git client based on the GitHub Workflow: GitHub DesktopGitHub DesktopSimple collaboration from your desktop This tool will simplify the most common Git operations involved in code collaboration; and thanks to the graphic interface, it might also help gain better insight into repositories’s structures. |
Beta Was this translation helpful? Give feedback.
-
Thanks! So if I have forked and cloned it eg to say Pycharm, and I want to make additions on the original code as a project of my own, do I need to a)create another repo on Github to which I push my changes b)Am I supposed to be working on a ‘branch’ of the original? |
Beta Was this translation helpful? Give feedback.
-
kiranikram:
We’ll yes, but you’ve already done that when you forked the repository. Your fork is a copy of the upstream (i.e. original) repository, and to make a contribution (a pull request) you need to first push the changes to your fork, then from GitHub’s home page of your fork you can create the pull request to the upstream project.
kiranikram:
Yes, this is very important! You should not apply (i.e. commit) changes directly to the Also, some repositories will only accept pull requests on specific branches (e.g. a |
Beta Was this translation helpful? Give feedback.
-
kiranikram:
This depends on the license terms really. Most open source licenses allow you to do this, as long as you honor the license terms. But some projects might demand that you contribute changes to the upstream.
kiranikram:
Most likely, you cloned locally the upstream repository directly, so when you tried to push your changes you were presented with an “access denied” error, for you don’t have write permission on the original repository. Which is why you need to first fork the repository, so you have your own copy to which you (and only you, initially) have write access. Understand that pull requests are natively part of Git, is an added layer by services like GitHub to allow easier cross-collaboration with people who don’t know each other. I.e. a way to allow contributions also from those who don’t have write access to the project. |
Beta Was this translation helpful? Give feedback.
-
As a last note, beware that when you fork a repository to you only get the Basically, when you start working on your changes you are doing so from a branch which you created from a given snapshot of the repository. In the meantime (let’s say you work on your feature for 5 days) the upstream repository might have been updated, so your branch is behind that of the original repo. You’ll need to set the It might sound all a bit complicated, but it’s actually simpler than it sounds, and it will all click-in once you actually make a PR or need to integrate updates from the upstream. Just keep in mind that Git is a distributed version control system, so you’re free to pull (i.e. get) updates from multiple versions of the same project (the original upstream repo, your fork, other forks, etc.). Branches are what allow you to keep different versions of the same code base (but with common ancestry) in a single repository. https://docs.github.com/en/github/using-git/managing-remote-repositories |
Beta Was this translation helpful? Give feedback.
-
Thank you, your answers have been invaluable! I appreciate the help! |
Beta Was this translation helpful? Give feedback.
This depends on the license terms really. Most open source licenses allow you to do this, as long as you honor the license terms. But some projects might demand that you contribute changes to the upstream.
Most likely, you cloned locally the upstream repository directly, so when you tried to push your changes you were presented with an “…