{"id":29504,"date":"2021-03-05T09:44:23","date_gmt":"2021-03-05T17:44:23","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=29504"},"modified":"2022-09-01T15:38:56","modified_gmt":"2022-09-01T22:38:56","slug":"git-merge-2","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/git-merge\/","title":{"rendered":"How to Use git merge"},"content":{"rendered":"\n<p>When contributing code to an app, usually you\u2019ll be committing that code on a feature branch in git. In this guide, we will look at how to keep the projects commits in sync. We will also take a brief look into what git and GitHub are.<br><\/p>\n\n\n\n<p>We can think of git as a command line tool that keeps track of all changes we make to our code. It\u2019s common commands are git add, git commit, git push for saving changes. It\u2019s what is known as version control.&nbsp;<br><\/p>\n\n\n\n<p>After these commands are used to save the changes made to your files, the git push command will save the files into a code hosting platform such as GitHub. GitHub stores your files in repositories and allows users to share code easily.<br><\/p>\n\n\n\n<p>Code hosting platforms such as GitHub make working remotely on projects together possible. As much of technology based jobs are migrating toward remote work, these solutions are more essential than ever.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">When to Use git merge<\/h2>\n\n\n\n<p>Whether you\u2019re working for a company with other developers, or contributing to open source projects for fun, you\u2019ll be using the git merge command. It is important to point out to know exactly how your company or the open source project accepts commits. Ask around and read the guidelines of contributing before going any further with a project.&nbsp;<br><\/p>\n\n\n\n<p>Typically, you\u2019ll be tasked with working on a feature for an app. As such, you\u2019ll be committing changes to your code on a feature branch. A feature branch is a branch that \u201cbranches\u201d off the master branch. The master branch is where the final production code lives.<br><\/p>\n\n\n\n<p>While in development mode, coding on the feature branch helps ensure the master branch is free from bugs that may arise while in development mode. Your feature branch should be named after the feature you\u2019re creating. At this point, you are in your feature branch which is connected to and branches off of the master.&nbsp;<br><\/p>\n\n\n\n<p>This chart is a good way to visualize how branches work.&nbsp;<br><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/q7nFmlMrilath6wRHLkkztCpBxhSVMJHdkO9_DfTNnb8pF0x0cS9_9k8kOjDYQNk0JFzYfMbyTX6NwzZdWgGM5KHbutDphCn6giRAwN5S6l-uXJfBwp9ui41ZOWaVGeULvOgGLYm\" alt=\"\"\/><\/figure>\n\n\n\n<p>We can see two branches here: topic and master. The topic branch is the feature branch. A, B, and C are commits happening in time with C being the most recent commit on the feature branch. G is the most recent commit on the master branch.<br><\/p>\n\n\n\n<p>This situation would occur if other teams made commits to the master branch after passing a code review. Since the latest version of the master branch is different from the version of the master branch on your machine (from git pull), we have version control issues. This could result in merge conflicts.&nbsp;<br><\/p>\n\n\n\n<p>From your feature branch, you can use the git merge master command to merge the master branch into your feature branch. This will bring your version of master up to date, and once your code passes the code review, can use git push origin master to push the changes to the master branch.<br><\/p>\n\n\n\n<p>Again, only push to the master branch once you have fulfilled all of the guidelines to contribute to the project. A best practice is to never push code directly to the master due to bugs or issues from untested code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Being comfortable using git commands is a necessity for any developer. Knowing how and when to use specific commands will keep the latest version of your code saved and prevent merge issues with other branches.<br><\/p>\n\n\n\n<p>When using git in the context of contributing to a company\u2019s code base or open source projects, make sure to follow their guidelines. Each project will want to review your code differently, so following the guidelines especially when using git merge master is a necessity.<\/p>\n","protected":false},"excerpt":{"rendered":"When contributing code to an app, usually you\u2019ll be committing that code on a feature branch in git. In this guide, we will look at how to keep the projects commits in sync. We will also take a brief look into what git and GitHub are. We can think of git as a command line&hellip;","protected":false},"author":104,"featured_media":28032,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17286],"tags":[],"class_list":{"0":"post-29504","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-git"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Git","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Use git merge | Career Karma<\/title>\n<meta name=\"description\" content=\"The git merge command allows two branches to update each other with the latest version of code. Learn how and when to use the git merge branch master command in this guide.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/git-merge\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use git merge\" \/>\n<meta property=\"og:description\" content=\"The git merge command allows two branches to update each other with the latest version of code. Learn how and when to use the git merge branch master command in this guide.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/git-merge\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-05T17:44:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-01T22:38:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"668\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ryan Manchester\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ryan Manchester\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/\"},\"author\":{\"name\":\"Ryan Manchester\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/92fd52a503f77fc058ec2d0666da9bd5\"},\"headline\":\"How to Use git merge\",\"datePublished\":\"2021-03-05T17:44:23+00:00\",\"dateModified\":\"2022-09-01T22:38:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/\"},\"wordCount\":627,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg\",\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/git-merge\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/git-merge\/\",\"name\":\"How to Use git merge | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg\",\"datePublished\":\"2021-03-05T17:44:23+00:00\",\"dateModified\":\"2022-09-01T22:38:56+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/92fd52a503f77fc058ec2d0666da9bd5\"},\"description\":\"The git merge command allows two branches to update each other with the latest version of code. Learn how and when to use the git merge branch master command in this guide.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/git-merge\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg\",\"width\":1000,\"height\":668},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-merge\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git\",\"item\":\"https:\/\/careerkarma.com\/blog\/git\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Use git merge\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/92fd52a503f77fc058ec2d0666da9bd5\",\"name\":\"Ryan Manchester\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/12\/ryan-manchester-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/12\/ryan-manchester-150x150.jpg\",\"caption\":\"Ryan Manchester\"},\"description\":\"Ryan is a technical writer at Career Karma, where he covers programming languages, technology, and web development. The Texas native earned his Bachelor's of Music Composition from the University of North Texas. Ryan is currently pursuing further education in web development, aiming to graduate from Flatiron School with a certification in full stack web development. Since joining the Career Karma team in November 2020, Ryan has used his expertise to cover topics like React and Ruby on Rails.\",\"sameAs\":[\"http:\/\/www.ryanmanchester.info\/\",\"https:\/\/www.linkedin.com\/in\/ryan-manchester-6537a630\/\"],\"url\":\"https:\/\/careerkarma.com\/blog\/author\/ryan-manchester\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Use git merge | Career Karma","description":"The git merge command allows two branches to update each other with the latest version of code. Learn how and when to use the git merge branch master command in this guide.","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:\/\/careerkarma.com\/blog\/git-merge\/","og_locale":"en_US","og_type":"article","og_title":"How to Use git merge","og_description":"The git merge command allows two branches to update each other with the latest version of code. Learn how and when to use the git merge branch master command in this guide.","og_url":"https:\/\/careerkarma.com\/blog\/git-merge\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2021-03-05T17:44:23+00:00","article_modified_time":"2022-09-01T22:38:56+00:00","og_image":[{"width":1000,"height":668,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg","type":"image\/jpeg"}],"author":"Ryan Manchester","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"Ryan Manchester","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/git-merge\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/git-merge\/"},"author":{"name":"Ryan Manchester","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/92fd52a503f77fc058ec2d0666da9bd5"},"headline":"How to Use git merge","datePublished":"2021-03-05T17:44:23+00:00","dateModified":"2022-09-01T22:38:56+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-merge\/"},"wordCount":627,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-merge\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg","articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/git-merge\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/git-merge\/","url":"https:\/\/careerkarma.com\/blog\/git-merge\/","name":"How to Use git merge | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-merge\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-merge\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg","datePublished":"2021-03-05T17:44:23+00:00","dateModified":"2022-09-01T22:38:56+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/92fd52a503f77fc058ec2d0666da9bd5"},"description":"The git merge command allows two branches to update each other with the latest version of code. Learn how and when to use the git merge branch master command in this guide.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/git-merge\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/git-merge\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/git-merge\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2021\/01\/pexels-christina-morillo-1181675-3.jpg","width":1000,"height":668},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/git-merge\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Git","item":"https:\/\/careerkarma.com\/blog\/git\/"},{"@type":"ListItem","position":3,"name":"How to Use git merge"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/92fd52a503f77fc058ec2d0666da9bd5","name":"Ryan Manchester","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/12\/ryan-manchester-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/12\/ryan-manchester-150x150.jpg","caption":"Ryan Manchester"},"description":"Ryan is a technical writer at Career Karma, where he covers programming languages, technology, and web development. The Texas native earned his Bachelor's of Music Composition from the University of North Texas. Ryan is currently pursuing further education in web development, aiming to graduate from Flatiron School with a certification in full stack web development. Since joining the Career Karma team in November 2020, Ryan has used his expertise to cover topics like React and Ruby on Rails.","sameAs":["http:\/\/www.ryanmanchester.info\/","https:\/\/www.linkedin.com\/in\/ryan-manchester-6537a630\/"],"url":"https:\/\/careerkarma.com\/blog\/author\/ryan-manchester\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/29504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/104"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=29504"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/29504\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/28032"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=29504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=29504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=29504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}