Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use origin and upstream of Git

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to use Git's origin and upstream". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use Git's origin and upstream".

Origin and upstream

This should be understood in the context of GitHub forks (fork out GitHub repo on GitHub before cloning GitHub locally)

Upstream usually refers to the original repository where you have forked (for more information on the upstream term, see the definitions of "upstream" and "downstream")

Origin is your own warehouse on GitHub, the clone of GitHub's original warehouse.

Explanation from the GitHub page:

When you clone a repo, it has a default remote object called origin, which points to the fork on the GitHub instead of the original repo after the fork

To track the original repo, you need to add another remote repository named upstream

Do the following:

Git remote add upstream git://github.com//

(use aUser/aRepo as a reference to the original creator and repository of your fork)

You will use upstream to get from the original repo (to keep your local copy synchronized with the original warehouse address of the project you want to participate in (from the original warehouse in forked):

Git fetch upstream

(by default, git fetch gets data separately from origin)

You will use origin to pull and push because you can contribute to your own code base.

Git pull

Git push

(again, if there are no parameters, "origin" is used by default.)

Submit the code for upstream, the original repository, by executing pull request.

Thank you for your reading, the above is the content of "how to use Git origin and upstream". After the study of this article, I believe you have a deeper understanding of how to use Git origin and upstream, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report