{"id":936,"date":"2015-07-14T15:53:00","date_gmt":"2015-07-14T15:53:00","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=936"},"modified":"2015-07-14T16:04:40","modified_gmt":"2015-07-14T16:04:40","slug":"git-basics","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/git-basics\/","title":{"rendered":"Git Basics"},"content":{"rendered":"<p><strong>UpStream and DownStream<\/strong><\/p>\n<p>In term of &#8220;flow of data&#8221;, your repo is at the bottom (&#8220;downstream&#8221;) of a flow coming from upstream repos (&#8220;pull from&#8221;) and going back to (the same or other) upstream repos (&#8220;push to&#8221;).<\/p>\n<p>In terms of source control, you&#8217;re downstream when you copy (clone, checkout, etc) from a repository. Information flowed &#8220;downstream&#8221; to you.<\/p>\n<p>When you make changes, you usually want to send them back &#8220;upstream&#8221; so they make it into that repository so that everyone pulling from the same source is working with all the same changes.<\/p>\n<p>You cannot always make a branch or pull an existing branch and push back to it, because you are not registered as a collaborator for that specific project.<\/p>\n<p><strong>Forking<\/strong><\/p>\n<p>Forking is nothing more than a clone on the GitHub server side:<\/p>\n<p>without the possibility to directly push back, with fork queue feature added to manage the merge request<br \/>\nYou keep a fork in sync with the original project by:<\/p>\n<ol>\n<li>adding the original project as a remote<\/li>\n<li>fetching regularly from that original project<\/li>\n<li>rebase your current development on top of the branch of interest you got updated from that fetch.<\/li>\n<\/ol>\n<p><strong>Only contributor can approve the changes you pushed into fork for merge with original code <\/strong><\/p>\n<p><strong>Clone<\/strong><\/p>\n<p>When you are cloning a GitHub repo on your local workstation, you cannot contribute back to the upstream repo unless you are explicitly declared as &#8220;contributor&#8221;.<br \/>\nSo that clone (to your local workstation) isn&#8217;t a &#8220;fork&#8221;. It is just a clone.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/codethataint.com\/blog\/wp-content\/uploads\/2015\/07\/cEJjT.png\" alt=\"Git\" width=\"446\" height=\"463\"\/><\/p>\n<p>upstream generally refers to the <em>original repo<\/em> that you have forked<br \/>\norigin is your <em>fork<\/em>: your own repo on GitHub, clone of the original repo of GitHub<\/p>\n<p><strong>The general pattern is as follows:<\/strong><\/p>\n<ol>\n<li>Fork the original project&#8217;s repository to have your own GitHub copy, to which you&#8217;ll then be allowed to push changes.<\/li>\n<li>Clone your GitHub repository onto your local machine<\/li>\n<li>Optionally, add the original repository as an additional remote repository on your local repository. You&#8217;ll then be able to fetch changes published in that repository directly.\n<\/li>\n<li>Make your modifications and your own commits locally.<\/li>\n<li>Push your changes to your GitHub repository (as you generally won&#8217;t have the write permissions on the project&#8217;s repository directly).\n<\/li>\n<li>\n Contact the Contributor once u have committed your changes in fork to pull it in orginal\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>UpStream and DownStream In term of &#8220;flow of data&#8221;, your repo is at the bottom (&#8220;downstream&#8221;) of a flow coming from upstream repos (&#8220;pull from&#8221;) and going back to (the same or other) upstream repos (&#8220;push to&#8221;). In terms of source control, you&#8217;re downstream when you copy (clone, checkout, etc) from a repository. Information flowed&hellip; <a href=\"https:\/\/codethataint.com\/blog\/git-basics\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[163],"tags":[],"class_list":["post-936","post","type-post","status-publish","format-standard","hentry","category-git"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=936"}],"version-history":[{"count":5,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/936\/revisions"}],"predecessor-version":[{"id":942,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/936\/revisions\/942"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}