{"id":1360,"date":"2019-04-05T12:03:17","date_gmt":"2019-04-05T06:33:17","guid":{"rendered":"http:\/\/blog.openwebsolutions.in\/?p=1360"},"modified":"2019-04-05T12:57:21","modified_gmt":"2019-04-05T07:27:21","slug":"steps-of-creating-a-new-branch-with-git","status":"publish","type":"post","link":"https:\/\/openwebsolutions.in\/blog\/steps-of-creating-a-new-branch-with-git\/","title":{"rendered":"Easy And Helpful Steps Of Creating A New Branch With Git"},"content":{"rendered":"<p>When you do a pull request on a branch, you&#8217;ll be able to still work on another branch and create another pull request on this other branch.<\/p>\n<p>Before creating a completely new branch, pull the changes from upstream. Your master needs to be up to date.<\/p>\n<pre>$ git pull<\/pre>\n<p>Create the branch on your native machine and switch in this branch :<\/p>\n<pre>$ git checkout -b [new branch name]<\/pre>\n<p>Push the branch on github :<\/p>\n<pre>$ git push origin [new branch name]<\/pre>\n<p>When you need to commit something in your branch, make sure to be in your branch. Add -u parameter to set upstream.<\/p>\n<p>You can see all the branches created by using :<\/p>\n<pre>$ git branch -a<\/pre>\n<p>Which will show :<\/p>\n<pre>* approval_messages\r\n  master\r\n  master_clean<\/pre>\n<p>Add a new remote for your branch :<\/p>\n<pre>$ git remote add [remote branch name][new branch name]<\/pre>\n<p>Push changes from your commit into your branch :<\/p>\n<pre>$ git push [remote branch name] [url]<\/pre>\n<p>Update your branch first\u00a0once the original branch from the official repository has been updated :<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>$ git fetch [remote branch name]<\/pre>\n<\/div>\n<p>Then you need to apply to merge changes if your branch is derivated from develop you need to do :<\/p>\n<pre>$ git merge [remote branch name]\/develop<\/pre>\n<p>Delete a branch on your local filesystem :<\/p>\n<pre>$ git branch -d [new branch name]<\/pre>\n<p>To force the deletion of local branch on your filesystem :<\/p>\n<pre>$ git branch -D [new branch name]<\/pre>\n<p>Delete the branch on github :<\/p>\n<pre>$ git push origin :[new branch name]<\/pre>\n<p>If you want to create a new branch:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>$ git branch [new branch name]<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>When you do a pull request on a branch, you&#8217;ll be able to still work on another branch and create another pull request on this other branch. Before creating a completely new branch, pull the changes from upstream. Your master needs to be up to date. $ git pull Create the branch on your native [&hellip;]<\/p>\n","protected":false},"author":30,"featured_media":1363,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18,5],"tags":[107],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Easy and Helpful steps Of Creating A New Branch With Git<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/openwebsolutions.in\/blog\/steps-of-creating-a-new-branch-with-git\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Easy and Helpful steps Of Creating A New Branch With Git\" \/>\n<meta property=\"og:description\" content=\"When you do a pull request on a branch, you&#8217;ll be able to still work on another branch and create another pull request on this other branch. Before creating a completely new branch, pull the changes from upstream. Your master needs to be up to date. $ git pull Create the branch on your native [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/openwebsolutions.in\/blog\/steps-of-creating-a-new-branch-with-git\/\" \/>\n<meta property=\"og:site_name\" content=\"Openweb Solutions Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-05T06:33:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-05T07:27:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2019\/03\/business-code-codes-207580.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"3827\" \/>\n\t<meta property=\"og:image:height\" content=\"2870\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/\",\"name\":\"Openweb Solutions Blog\",\"description\":\"Transforming ideas into reality\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/openwebsolutions.in\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/steps-of-creating-a-new-branch-with-git\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2019\/03\/business-code-codes-207580.jpg\",\"width\":3827,\"height\":2870},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/steps-of-creating-a-new-branch-with-git\/#webpage\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/steps-of-creating-a-new-branch-with-git\/\",\"name\":\"Easy and Helpful steps Of Creating A New Branch With Git\",\"isPartOf\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/steps-of-creating-a-new-branch-with-git\/#primaryimage\"},\"datePublished\":\"2019-04-05T06:33:17+00:00\",\"dateModified\":\"2019-04-05T07:27:21+00:00\",\"author\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/a0964abd0123c3921478c855abf08c11\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/openwebsolutions.in\/blog\/steps-of-creating-a-new-branch-with-git\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/a0964abd0123c3921478c855abf08c11\",\"name\":\"Aheli Bharadwaj\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fa8d1449e4d157d4013e9b67ce92f60f?s=96&r=g\",\"caption\":\"Aheli Bharadwaj\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/1360"}],"collection":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/comments?post=1360"}],"version-history":[{"count":5,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/1360\/revisions"}],"predecessor-version":[{"id":1529,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/1360\/revisions\/1529"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media\/1363"}],"wp:attachment":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media?parent=1360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/categories?post=1360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/tags?post=1360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}