{"id":79005,"date":"2024-07-29T06:00:59","date_gmt":"2024-07-29T13:00:59","guid":{"rendered":"https:\/\/github.blog\/?p=79005"},"modified":"2024-07-29T06:05:25","modified_gmt":"2024-07-29T13:05:25","slug":"beginners-guide-to-github-adding-code-to-your-repository","status":"publish","type":"post","link":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/","title":{"rendered":"Beginner\u2019s guide to GitHub: Adding code to your repository"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><p>Welcome back to <a href=\"https:\/\/www.youtube.com\/playlist?list=PL0lo9MOBetEFcp4SCWinBdpml9B2U25-f\">GitHub for Beginners<\/a>, a series designed to help you navigate GitHub with ease.<\/p>\n<p>If you&rsquo;ve been following along, we&rsquo;ve covered some basics of GitHub, including <a href=\"https:\/\/github.blog\/2024-06-10-top-12-git-commands-every-developer-must-know\/\">the top Git commands every developer should know<\/a>, <a href=\"https:\/\/github.blog\/2024-06-24-beginners-guide-to-github-repositories-how-to-create-your-first-repo\/\">how to create repositories<\/a>, and <a href=\"https:\/\/github.blog\/2024-07-08-beginners-guide-to-github-uploading-files-and-folders-to-github\/\">how to upload files and folders to your repository<\/a>.<\/p>\n<p>Today, we are going to talk about the <a href=\"https:\/\/docs.github.com\/get-started\/using-github\/github-flow\">GitHub flow<\/a>, and how to use it to add code to our repository.. The GitHub flow is a way of using GitHub to share resources with others and work collaboratively. It&rsquo;s not just for code. You can also use this process to collaborate on anything you store in a repository on GitHub.<\/p>\n<div class=\"mod-vh position-relative\" style=\"height: 0; padding-bottom: calc((9 \/ 16)*100%);\">\n\t\t\t<iframe loading=\"lazy\" class=\"position-absolute top-0 left-0 width-full height-full\" src=\"https:\/\/www.youtube.com\/embed\/g2XjJhrGGg4?version=3&amp;rel=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1&amp;fs=1&amp;hl=en-US&amp;autohide=2&amp;wmode=transparent\" title=\"YouTube video player\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe>\n\t\t<\/div>\n<h2 id=\"cloning-a-repository\" id=\"cloning-a-repository\" ><a class=\"heading-link\" href=\"#cloning-a-repository\">Cloning a repository<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>Adding code to your repository starts with <a href=\"https:\/\/docs.github.com\/repositories\/creating-and-managing-repositories\/cloning-a-repository\">cloning<\/a> that repository. Cloning a repository <strong>creates a local copy<\/strong> that you can use to do your work. By keeping this local copy synchronized with the remote repository stored in GitHub, you&rsquo;re able to get the latest changes and push your updates so others can receive them.<\/p>\n<p>First, navigate to your repository on GitHub that you want to clone&mdash;I&rsquo;ll be cloning <a href=\"https:\/\/github.com\/LadyKerr\/GitGoing\">this repository<\/a>. Click on the green button that says &ldquo;&lt;&gt; Code&rdquo;. You will see a window that includes a URL for your repository with a &ldquo;Copy&rdquo; button next to it under the &ldquo;Local&rdquo; tab. Click the &ldquo;Copy&rdquo; button.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/1-gfb-clone-repo.png?w=1024&#038;resize=1024%2C507\" alt='Clicking the green button labeled \"Code\" in order to clone a repository called \"GitGoing.\"' width=\"1024\" height=\"507\" class=\"aligncenter size-large wp-image-79006 width-fit\" srcset=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/1-gfb-clone-repo.png?w=1468 1468w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/1-gfb-clone-repo.png?w=300 300w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/1-gfb-clone-repo.png?w=768 768w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/1-gfb-clone-repo.png?w=1024 1024w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>Now, open your terminal and type <code>git clone<\/code> with an extra space at the end. Then, paste the URL for your repository and press Enter.<\/p>\n<div style=\"width: 1254px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-79005-1\" width=\"1254\" height=\"704\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/2-clone_repo.mp4#t=0.001?_=1\" \/><a href=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/2-clone_repo.mp4#t=0.001\">https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/2-clone_repo.mp4#t=0.001<\/a><\/video><\/div>\n<p>Once the command finishes, enter the directory by typing <code>cd project<\/code> and then hitting Enter. Make sure to replace <code>project<\/code> with the name of your repository. Once in the directory, you&rsquo;ll be on the <strong>main<\/strong> branch. You can verify your branch by typing <code>git status<\/code> and pressing Enter.<\/p>\n<h2 id=\"creating-a-new-branch\" id=\"creating-a-new-branch\" ><a class=\"heading-link\" href=\"#creating-a-new-branch\">Creating a new branch<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>The first thing that you want to do whenever adding code to your repository is create a new branch. This is an essential part of the GitHub flow because it protects your <strong>main<\/strong> branch.<\/p>\n<p>When you create a new branch, you will need to give it a name. Since you are creating the initial version of the project, you can call the branch <strong>version1<\/strong>. When you name branches, it is helpful to use names that are descriptive of the work you are doing in that branch. In your terminal, type <code>git checkout -b version1<\/code> and then press Enter.<\/p>\n<div style=\"width: 1254px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-79005-2\" width=\"1254\" height=\"704\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/3-create_branch.mp4#t=0.001?_=2\" \/><a href=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/3-create_branch.mp4#t=0.001\">https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/3-create_branch.mp4#t=0.001<\/a><\/video><\/div>\n<p>This creates a new branch called <strong>version1<\/strong>.<\/p>\n<h2 id=\"committing-changes-with-github-desktop\" id=\"committing-changes-with-github-desktop\" ><a class=\"heading-link\" href=\"#committing-changes-with-github-desktop\">Committing changes with GitHub Desktop<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>In addition to using the terminal, you can use <a href=\"https:\/\/github.com\/apps\/desktop\">GitHub Desktop<\/a> to create new branches and add code. Download and open up GitHub Desktop. Just like before, the first thing you need to do is clone the repository. Click the option that says, &ldquo;Clone a Repository from the Internet&hellip;&rdquo; Paste in the URL for your repository in the box provided. If you don&rsquo;t want to enter the full URL, you can instead enter the GitHub user and repository names separated by a forward slash: <code>&lt;username&gt;\/&lt;repo&gt;<\/code>. Then, click the &ldquo;Clone&rdquo; button.<\/p>\n<div style=\"width: 1254px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-79005-3\" width=\"1254\" height=\"704\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/4-gh_desktop_clone.mp4#t=0.001?_=3\" \/><a href=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/4-gh_desktop_clone.mp4#t=0.001\">https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/4-gh_desktop_clone.mp4#t=0.001<\/a><\/video><\/div>\n<p>Once connected to the repository, you need to create a new branch. Click the section of the ribbon at the top of the window that says &ldquo;Current Branch.&rdquo; This opens a pull-down window displaying the branches. Click the button that says &ldquo;New Branch,&rdquo; name your new branch <strong>CSS<\/strong>, and click the blue button that says, &ldquo;Create Branch.&rdquo;<\/p>\n<div style=\"width: 1254px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-79005-4\" width=\"1254\" height=\"704\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/5-create_branch.mp4#t=0.001?_=4\" \/><a href=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/5-create_branch.mp4#t=0.001\">https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/5-create_branch.mp4#t=0.001<\/a><\/video><\/div>\n<p>Now that the branch is created, you can save code to the project directory or move it using your file manager. Save or copy a <em>style.css<\/em> file into the project folder; you can find the one I&rsquo;m using <a href=\"https:\/\/github.com\/LadyKerr\/GitGoing\/blob\/main\/style.css\">here<\/a>. As soon as you add code to your project, GitHub Desktop will be aware of the change. You will see the file listed as a changed file and have the option to commit this change to the <strong>CSS<\/strong> branch.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch.png?w=1024&#038;resize=1024%2C521\" alt=\"View of style.css in GitHub Desktop, with the option to commit the changed file to the CSS branch.\" width=\"1024\" height=\"521\" class=\"aligncenter size-large wp-image-79011 width-fit\" srcset=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch.png?w=1765 1765w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch.png?w=300 300w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch.png?w=768 768w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch.png?w=1024 1024w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch.png?w=1536 1536w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>Enter a summary of the changes you have made and a brief description in the boxes immediately above the blue &ldquo;Commit to CSS&rdquo; button. Then, click the button. Now that you&rsquo;ve made the changes to that branch, you&rsquo;re done! Now, you can push your code to the remote repository and get the pull request going.<\/p>\n<h2 id=\"committing-changes-with-terminal\" id=\"committing-changes-with-terminal\" ><a class=\"heading-link\" href=\"#committing-changes-with-terminal\">Committing changes with terminal<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>Moving back to the terminal, verify that you are in the appropriate project directory and run <code>touch index.html script.js<\/code> to create empty files with those names in your local repository. Using your code editor of choice, open up these files and either write or copy the code you want to upload to GitHub. Once you are done, return to your terminal.<\/p>\n<p>Run <code>git status<\/code> in your terminal to see the list of files that you&rsquo;ve worked on. At this point, you should see the two files you created: <em>index.html<\/em> and <em>script.js<\/em>. Add these files to your staging area by running <code>git add .<\/code> to add them both at the same time. This command adds all of the untracked files in your project directory. Once they are added, commit these files to the staging area by running <code>git commit -m \"created initial project\"<\/code> in your terminal.<\/p>\n<div style=\"width: 1254px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-79005-5\" width=\"1254\" height=\"704\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/7-commit_terminal.mp4#t=0.001?_=5\" \/><a href=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/7-commit_terminal.mp4#t=0.001\">https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/7-commit_terminal.mp4#t=0.001<\/a><\/video><\/div>\n<p>Now, it is time to push your code to your repository. Before doing so, run a quick <code>git status<\/code> command to make sure you don&rsquo;t have any untracked changes. Then, run <code>git push origin version1<\/code> to send your code up to GitHub.<\/p>\n<h2 id=\"opening-a-pull-request\" id=\"opening-a-pull-request\" ><a class=\"heading-link\" href=\"#opening-a-pull-request\">Opening a pull request<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>Now that your code has been pushed, use your browser to visit your repository on GitHub. You&rsquo;ll see a small dialog at the top of your repository indicating that <strong>CSS<\/strong> and <strong>version1<\/strong> had recent changes. In order to merge those changes into your main branch, you&rsquo;re going to want to open a <a href=\"https:\/\/docs.github.com\/pull-requests\/collaborating-with-pull-requests\/proposing-changes-to-your-work-with-pull-requests\/about-pull-requests\">pull request<\/a>. Click the green button in the dialog box that says &ldquo;Compare &amp; pull request&rdquo; for the <strong>CSS<\/strong> branch.<\/p>\n<p>Add a title that summarizes the changes and a brief description indicating what changes you made. Then, scroll down and click the green button under the description that says, &ldquo;Create pull request.&rdquo; Congratulations! You&rsquo;ve just opened your first pull request! &#127881;<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch-1.png?w=1024&#038;resize=1024%2C521\" alt=\"Screenshot of the pull requests tab in the GitGoing repository showing where you can add a description and create the pull request.\" width=\"1024\" height=\"521\" class=\"aligncenter size-large wp-image-79013 width-fit\" srcset=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch-1.png?w=1765 1765w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch-1.png?w=300 300w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch-1.png?w=768 768w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch-1.png?w=1024 1024w, https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/8-css-branch-1.png?w=1536 1536w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>After opening your pull request, GitHub will perform some checks to make sure you can manually merge the pull request. If the check takes more than a few seconds, you might need to reload the page. Once the checks are complete, you will see a green button that says, &ldquo;Merge pull request.&rdquo; This will open a dialog box that gives you the chance to provide a title and description of the changes. These fields will be automatically populated with the information you added when you created the pull request. Click the green button under the description that says, &ldquo;Confirm merge.&rdquo; This pulls your changes back into the <strong>main<\/strong> branch.<\/p>\n<p>Now, click the tab at the top of the window that says &ldquo;&lt;&gt; Code&rdquo;. You&rsquo;ll see that you still have a notification for the changes on <strong>version1<\/strong>. Go ahead and click the &ldquo;Compare &amp; pull request&rdquo; button, and once again create a pull request. However, don&rsquo;t merge it quite yet!<\/p>\n<h2 id=\"merging-to-main-branch\" id=\"merging-to-main-branch\" ><a class=\"heading-link\" href=\"#merging-to-main-branch\">Merging to main branch<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>You may have realized that your <strong>main<\/strong> branch now has changes which don&rsquo;t exist in your local <strong>version1<\/strong> branch. This is because your <strong>version1<\/strong> branch was created using a copy of <strong>main<\/strong> before the <strong>CSS<\/strong> changes were uploaded. When you opened the pull request, you might have even received a warning indicating that your branch was behind <strong>main<\/strong>.<\/p>\n<p>In order for you to safely upload your changes from <strong>version1<\/strong> into <strong>main<\/strong>, you&rsquo;re going to pull those latest changes from <strong>main<\/strong> into your local <strong>version1<\/strong> branch. To do this, return to your terminal.<\/p>\n<p>Type <code>git switch main<\/code> and then press enter. Then, run <code>git pull<\/code> to pull in the CSS code changes added to the remote repository. Then, run <code>git switch version1<\/code> to return to your <strong>version1<\/strong> branch. After changing branches, run <code>git merge main<\/code> to merge the changes from the <strong>main<\/strong> branch into your current branch. After running this command, a text editor will appear with a merge message. Type <code>:wq<\/code> to save the message and quit the editor. Now you need to push those changes, which you do by running the <code>git push origin version1<\/code> command.<\/p>\n<div style=\"width: 1116px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-79005-6\" width=\"1116\" height=\"626\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/9-merge-css-version1.mp4#t=0.001?_=6\" \/><a href=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/9-merge-css-version1.mp4#t=0.001\">https:\/\/github.blog\/wp-content\/uploads\/2024\/07\/9-merge-css-version1.mp4#t=0.001<\/a><\/video><\/div>\n<p>Return to your browser and navigate to the pull request you created. If you need to find it again, navigate to your repository and click the &ldquo;Pull requests&rdquo; tab at the top of the window, then select the pull request. Once you are on the pull request, select the green button that says, &ldquo;Merge pull request.&rdquo;<\/p>\n<h2 id=\"deleting-a-branch\" id=\"deleting-a-branch\" ><a class=\"heading-link\" href=\"#deleting-a-branch\">Deleting a branch<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>Now that your changes have been uploaded to the <strong>main<\/strong> branch, you can delete your old branch. First, switch over to your <strong>main<\/strong> branch by running <code>git switch main<\/code> in your terminal. Then, type <code>git branch -d version1<\/code> and press enter. This deletes your <strong>version1<\/strong> branch.<\/p>\n<h2 id=\"your-next-steps\" id=\"your-next-steps\" ><a class=\"heading-link\" href=\"#your-next-steps\">Your next steps<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>Now that you have learned how to add code to your repositories, you can create projects and collaborate with other developers!<\/p>\n<p>If you have any questions, pop them in the <a href=\"https:\/\/gh.io\/learn-git\">GitHub Community thread<\/a> and we&rsquo;ll be sure to respond.<\/p>\n<p>Here are some more resources to help you on your GitHub journey:<\/p>\n<ul>\n<li><a href=\"https:\/\/learn.microsoft.com\/en-us\/collections\/o1njfe825p602p\">GitHub Foundations Certificate<\/a><\/li>\n<li><a href=\"https:\/\/docs.github.com\/repositories\/working-with-files\/managing-files\/adding-a-file-to-a-repository\">Adding a file to a repository<\/a><\/li>\n<li><a href=\"https:\/\/docs.github.com\/repositories\/working-with-files\/managing-files\/deleting-files-in-a-repository\">Deleting files from a repository<\/a><\/li>\n<li><a href=\"https:\/\/docs.github.com\/pull-requests\/collaborating-with-pull-requests\/incorporating-changes-from-a-pull-request\/merging-a-pull-request\">Merging a pull request<\/a><\/li>\n<\/ul>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Take the next step in our GitHub for Beginners series and add code to your repository. Learn how to create branches and upload changes into a pull request.<\/p>\n","protected":false},"author":2041,"featured_media":78179,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_gh_post_show_toc":"yes","_gh_post_is_no_robots":"no","_gh_post_is_featured":"yes","_gh_post_is_excluded":"no","_gh_post_is_unlisted":"no","_gh_post_related_link_1":"","_gh_post_related_link_2":"","_gh_post_related_link_3":"","_gh_post_sq_img":"https:\/\/github.blog\/wp-content\/uploads\/2024\/06\/Professortocat_v2.png","_gh_post_sq_img_id":"78333","_gh_post_cta_title":"","_gh_post_cta_text":"","_gh_post_cta_link":"","_gh_post_cta_button":"Click Here to Learn More","_gh_post_recirc_hide":"no","_gh_post_recirc_col_1":"78957","_gh_post_recirc_col_2":"78959","_gh_post_recirc_col_3":"78961","_gh_post_recirc_col_4":"77524","_featured_video":"","_gh_post_additional_query_params":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false,"_links_to":"","_links_to_target":""},"categories":[3298,3302],"tags":[3286],"coauthors":[2854],"class_list":["post-79005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developer-skills","category-github","tag-github-for-beginners"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.7 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Beginner\u2019s guide to GitHub: Adding code to your repository - The GitHub Blog<\/title>\n<meta name=\"description\" content=\"Take the next step in our GitHub for Beginners series and add code to your repository. Learn how to create branches and upload changes into a pull request.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Beginner\u2019s guide to GitHub: Adding code to your repository\" \/>\n<meta property=\"og:description\" content=\"Take the next step in our GitHub for Beginners series and add code to your repository. Learn how to create branches and upload changes into a pull request.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/\" \/>\n<meta property=\"og:site_name\" content=\"The GitHub Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-29T13:00:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-29T13:05:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/github.blog\/wp-content\/uploads\/2024\/05\/GitHub-for-beginners.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"840\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kedasha Kerr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kedasha Kerr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/\"},\"author\":{\"name\":\"Kedasha Kerr\",\"@id\":\"https:\\\/\\\/github.blog\\\/#\\\/schema\\\/person\\\/c7307d5b9eb99168bed497b7e6b0a950\"},\"headline\":\"Beginner\u2019s guide to GitHub: Adding code to your repository\",\"datePublished\":\"2024-07-29T13:00:59+00:00\",\"dateModified\":\"2024-07-29T13:05:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/\"},\"wordCount\":1582,\"image\":{\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/GitHub-for-beginners.png?fit=1600%2C840\",\"keywords\":[\"GitHub for beginners\"],\"articleSection\":[\"Developer skills\",\"GitHub\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/\",\"url\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/\",\"name\":\"Beginner\u2019s guide to GitHub: Adding code to your repository - The GitHub Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/github.blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/GitHub-for-beginners.png?fit=1600%2C840\",\"datePublished\":\"2024-07-29T13:00:59+00:00\",\"dateModified\":\"2024-07-29T13:05:25+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/github.blog\\\/#\\\/schema\\\/person\\\/c7307d5b9eb99168bed497b7e6b0a950\"},\"description\":\"Take the next step in our GitHub for Beginners series and add code to your repository. Learn how to create branches and upload changes into a pull request.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/#primaryimage\",\"url\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/GitHub-for-beginners.png?fit=1600%2C840\",\"contentUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/GitHub-for-beginners.png?fit=1600%2C840\",\"width\":1600,\"height\":840},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/beginners-guide-to-github-adding-code-to-your-repository\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/github.blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Developer skills\",\"item\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"GitHub\",\"item\":\"https:\\\/\\\/github.blog\\\/developer-skills\\\/github\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Beginner\u2019s guide to GitHub: Adding code to your repository\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/github.blog\\\/#website\",\"url\":\"https:\\\/\\\/github.blog\\\/\",\"name\":\"The GitHub Blog\",\"description\":\"Updates, ideas, and inspiration from GitHub to help developers build and design software.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/github.blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/github.blog\\\/#\\\/schema\\\/person\\\/c7307d5b9eb99168bed497b7e6b0a950\",\"name\":\"Kedasha Kerr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g76275409088bcdfde49439d0290b472b\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g\",\"caption\":\"Kedasha Kerr\"},\"description\":\"Kedasha is a Developer Advocate at GitHub where she enjoys sharing the lessons she's learned with the wider developer community. She finds joy in helping others learn about the tech industry and loves sharing her experience as a software developer. Find her online @itsthatladydev.\",\"url\":\"https:\\\/\\\/github.blog\\\/author\\\/ladykerr\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Beginner\u2019s guide to GitHub: Adding code to your repository - The GitHub Blog","description":"Take the next step in our GitHub for Beginners series and add code to your repository. Learn how to create branches and upload changes into a pull request.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/","og_locale":"en_US","og_type":"article","og_title":"Beginner\u2019s guide to GitHub: Adding code to your repository","og_description":"Take the next step in our GitHub for Beginners series and add code to your repository. Learn how to create branches and upload changes into a pull request.","og_url":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/","og_site_name":"The GitHub Blog","article_published_time":"2024-07-29T13:00:59+00:00","article_modified_time":"2024-07-29T13:05:25+00:00","og_image":[{"width":1600,"height":840,"url":"https:\/\/github.blog\/wp-content\/uploads\/2024\/05\/GitHub-for-beginners.png","type":"image\/png"}],"author":"Kedasha Kerr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kedasha Kerr","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/#article","isPartOf":{"@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/"},"author":{"name":"Kedasha Kerr","@id":"https:\/\/github.blog\/#\/schema\/person\/c7307d5b9eb99168bed497b7e6b0a950"},"headline":"Beginner\u2019s guide to GitHub: Adding code to your repository","datePublished":"2024-07-29T13:00:59+00:00","dateModified":"2024-07-29T13:05:25+00:00","mainEntityOfPage":{"@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/"},"wordCount":1582,"image":{"@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/#primaryimage"},"thumbnailUrl":"https:\/\/github.blog\/wp-content\/uploads\/2024\/05\/GitHub-for-beginners.png?fit=1600%2C840","keywords":["GitHub for beginners"],"articleSection":["Developer skills","GitHub"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/","url":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/","name":"Beginner\u2019s guide to GitHub: Adding code to your repository - The GitHub Blog","isPartOf":{"@id":"https:\/\/github.blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/#primaryimage"},"image":{"@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/#primaryimage"},"thumbnailUrl":"https:\/\/github.blog\/wp-content\/uploads\/2024\/05\/GitHub-for-beginners.png?fit=1600%2C840","datePublished":"2024-07-29T13:00:59+00:00","dateModified":"2024-07-29T13:05:25+00:00","author":{"@id":"https:\/\/github.blog\/#\/schema\/person\/c7307d5b9eb99168bed497b7e6b0a950"},"description":"Take the next step in our GitHub for Beginners series and add code to your repository. Learn how to create branches and upload changes into a pull request.","breadcrumb":{"@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/#primaryimage","url":"https:\/\/github.blog\/wp-content\/uploads\/2024\/05\/GitHub-for-beginners.png?fit=1600%2C840","contentUrl":"https:\/\/github.blog\/wp-content\/uploads\/2024\/05\/GitHub-for-beginners.png?fit=1600%2C840","width":1600,"height":840},{"@type":"BreadcrumbList","@id":"https:\/\/github.blog\/developer-skills\/github\/beginners-guide-to-github-adding-code-to-your-repository\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/github.blog\/"},{"@type":"ListItem","position":2,"name":"Developer skills","item":"https:\/\/github.blog\/developer-skills\/"},{"@type":"ListItem","position":3,"name":"GitHub","item":"https:\/\/github.blog\/developer-skills\/github\/"},{"@type":"ListItem","position":4,"name":"Beginner\u2019s guide to GitHub: Adding code to your repository"}]},{"@type":"WebSite","@id":"https:\/\/github.blog\/#website","url":"https:\/\/github.blog\/","name":"The GitHub Blog","description":"Updates, ideas, and inspiration from GitHub to help developers build and design software.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/github.blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/github.blog\/#\/schema\/person\/c7307d5b9eb99168bed497b7e6b0a950","name":"Kedasha Kerr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g76275409088bcdfde49439d0290b472b","url":"https:\/\/secure.gravatar.com\/avatar\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f7068adc72a5044fad52dad7d2a26c374860c1e491761f8ec5cf7750152f4adb?s=96&d=mm&r=g","caption":"Kedasha Kerr"},"description":"Kedasha is a Developer Advocate at GitHub where she enjoys sharing the lessons she's learned with the wider developer community. She finds joy in helping others learn about the tech industry and loves sharing her experience as a software developer. Find her online @itsthatladydev.","url":"https:\/\/github.blog\/author\/ladykerr\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/github.blog\/wp-content\/uploads\/2024\/05\/GitHub-for-beginners.png?fit=1600%2C840","jetpack_shortlink":"https:\/\/wp.me\/pamS32-kyh","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts\/79005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/users\/2041"}],"replies":[{"embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/comments?post=79005"}],"version-history":[{"count":7,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts\/79005\/revisions"}],"predecessor-version":[{"id":79030,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts\/79005\/revisions\/79030"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/media\/78179"}],"wp:attachment":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/media?parent=79005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/categories?post=79005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/tags?post=79005"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/coauthors?post=79005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}