This sets up a remote called "upstream" that points to the original repository.įetch changes from "upstream": To get any changes that have been made to the original repository, you can run the git fetch command with the "upstream" remote. You can do this using the git remote add command. Set up "upstream" remote: To keep your fork up to date with any changes that are made to the original repository, you can set up a remote called "upstream" that points to the original repository. This allows you to push changes to your fork using the git push command. Set up "origin" remote: When you clone your fork, Git automatically sets up a remote called "origin" that points to your fork on GitHub. This sets up a local copy of the repository on your machine. This creates a copy of the repository in your own account, which is now called "your-username/example-project".Ĭlone the repository: You clone your fork of the repository to your local machine using the git clone command. Here's how the "origin" and "upstream" repositories come into play:įork the repository: You go to the "example-project" repository on GitHub and click the "Fork" button. To contribute to this project, you would typically fork the repository to your own account, clone it to your local machine, make changes, and then submit a pull request to the original repository. Let's say you want to contribute to an open-source project on GitHub called "example-project" that is owned by another user. "origin" refers to your own fork of a repository, while "upstream" refers to the original repository that you forked from. You can set up a remote called "upstream" that points to this repository, which allows you to keep your fork up to date with any changes that are made to the upstream repository. This is the repository that you originally copied when you created your fork. "Upstream" refers to the original repository that you forked from. When you clone your fork to your local machine, Git automatically sets up a remote called "origin" that points to your fork on GitHub. This copy is called a fork, and the original repository is called the upstream repository. When you fork a repository on GitHub, you create a copy of it in your own account. "Origin" typically refers to your own fork of a repository. In the context of GitHub, "origin" and "upstream" refer to two different repositories. What is the difference between origin and upstream on GitHub? You will contribute back to the upstream repo by making a pull request. (again, without parameters, 'origin' is used by default) You will use origin to pull and push since you can contribute to your own repository. ( git fetch alone would fetch from origin by default, which is not what is needed here) You will use upstream to fetch from the original repo (in order to keep your local copy in sync with the project you want to contribute to). 2021, the unauthenticated git protocol ( git://.) on port 9418 is no longer supported on GitHub. (with aUser/aRepo the reference for the original creator and repository, that you have forked) To keep track of the original repo, you need to add another remote named upstream git remote add upstream When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from.
0 Comments
Leave a Reply. |