{"id":511,"date":"2021-04-10T18:13:23","date_gmt":"2021-04-10T18:13:23","guid":{"rendered":"http:\/\/meatpie\/?p=511"},"modified":"2021-04-10T18:13:23","modified_gmt":"2021-04-10T18:13:23","slug":"my-first-git-pull-request","status":"publish","type":"post","link":"https:\/\/snersbots.co.uk\/index.php\/my-first-git-pull-request\/","title":{"rendered":"My First Git Pull Request"},"content":{"rendered":"\n<p>Found a very nice git repository with VisualCrossing sample code. Of course theirs doesn&#8217;t compile in my project &#8211; so this is my big opportunity &#8211; my first attempt at contributing to a project.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Medium has already written up the process very nicely <a href=\"https:\/\/medium.com\/swlh\/forks-and-pull-requests-how-to-contribute-to-github-repos-8843fac34ce8\">here<\/a>. But of course I have to do it myself and make my own notes.<\/p>\n\n\n\n<p>I got lost on medium, so now trying this <a href=\"https:\/\/wiki.diasporafoundation.org\/Git_workflow#Rebase_your_development_branch_on_the_latest_upstream\">link<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"107\" src=\"http:\/\/meatpie\/wp-content\/uploads\/2021\/03\/Visual-Crossing-Fork-1024x107.png\" alt=\"\" class=\"wp-image-512\" srcset=\"https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/Visual-Crossing-Fork-1024x107.png 1024w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/Visual-Crossing-Fork-300x31.png 300w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/Visual-Crossing-Fork-768x80.png 768w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/Visual-Crossing-Fork-1536x160.png 1536w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/Visual-Crossing-Fork.png 1547w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Go to the repo you want to contribute to, and click Fork.<\/figcaption><\/figure><\/div>\n\n\n\n<p>Once forked, this is added to your own repository. Clone the copy in your own repo. Amend as required, and test. <\/p>\n\n\n\n<p>On your local copy, give it the upstream url &#8211; that is the one you forked. Note to self, make sure you cd to within your project folder.<\/p>\n\n\n\n<p><code>git remote add upstream https:\/\/github.com\/visualcrossing\/WeatherApi.git<\/code><\/p>\n\n\n\n<p>Use <code>git remote -v<\/code> to check that this worked.<\/p>\n\n\n\n<p>So make a branch. Update the code. Push to your own repo. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"870\" height=\"254\" src=\"http:\/\/meatpie\/wp-content\/uploads\/2021\/03\/git-pull-does-not-work-1.png\" alt=\"\" class=\"wp-image-523\" srcset=\"https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/git-pull-does-not-work-1.png 870w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/git-pull-does-not-work-1-300x88.png 300w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/git-pull-does-not-work-1-768x224.png 768w\" sizes=\"auto, (max-width: 870px) 100vw, 870px\" \/><figcaption>Try git pull now, and end up with this <\/figcaption><\/figure><\/div>\n\n\n\n<p><code>git fetch upstream<\/code><br><code>git checkout -b AddAndroidJava upstream\/master<\/code><\/p>\n\n\n\n<p>Add your code and commit like usual but don&#8217;t push yet.<\/p>\n\n\n\n<p><code>git push origin AddAndroidJava<\/code><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"834\" height=\"299\" src=\"http:\/\/meatpie\/wp-content\/uploads\/2021\/03\/action-on-the-upstream-github.png\" alt=\"\" class=\"wp-image-527\" srcset=\"https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/action-on-the-upstream-github.png 834w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/action-on-the-upstream-github-300x108.png 300w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/action-on-the-upstream-github-768x275.png 768w\" sizes=\"auto, (max-width: 834px) 100vw, 834px\" \/><figcaption>Now a new message has appeared on the upstream git page. <\/figcaption><\/figure><\/div>\n\n\n\n<p>So I clicked the button and &#8230;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"714\" height=\"349\" src=\"http:\/\/meatpie\/wp-content\/uploads\/2021\/03\/Create-Pull-Request.png\" alt=\"\" class=\"wp-image-529\" srcset=\"https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/Create-Pull-Request.png 714w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/03\/Create-Pull-Request-300x147.png 300w\" sizes=\"auto, (max-width: 714px) 100vw, 714px\" \/><figcaption>The better half very sensibly advised that I add the IDE name and version, as well as the Android version<\/figcaption><\/figure><\/div>\n\n\n\n<p>So that is it. I have submitted my first real Pull Request. Let&#8217;s see if anyone comments on it. \u2603\ufe0e \u2603\ufe0e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Found a very nice git repository with VisualCrossing sample code. Of course theirs doesn&#8217;t compile in my project &#8211; so this is my big opportunity &#8211; my first attempt at contributing to a project.<\/p>\n","protected":false},"author":1,"featured_media":529,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[33,34,30],"class_list":["post-511","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-other-projects","tag-git","tag-pull-request","tag-visual-crossing"],"_links":{"self":[{"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=511"}],"version-history":[{"count":15,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":531,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/511\/revisions\/531"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/media\/529"}],"wp:attachment":[{"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}