{"id":3208,"date":"2011-03-04T01:35:24","date_gmt":"2011-03-03T20:05:24","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=3208"},"modified":"2016-12-19T15:30:06","modified_gmt":"2016-12-19T10:00:06","slug":"git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/","title":{"rendered":"git branching model: choose branches for deletion &#8211; see whats remaining for the merge"},"content":{"rendered":"<p>This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches).<br \/>\nBy practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\/tested &#8211; they are merged back into the same root branch.<\/p>\n<p>\nWorking in such a manner is pretty nice and clean. But things start getting messy if we don&#8217;t delete the branches on time (esp. after merging into root branch). In that case when we run command &#8211;<br \/>\n[groovy]<br \/>\n     git branch<br \/>\n[\/groovy]<br \/>\nIt shows us zillions of branches and we start getting feeling to get a rid of all futile branches. But we don&#8217;t know which branches are already merged and which are still under progress or yet to be tested.<br \/>\n<\/p>\n<p><b>Solution to this problem<\/b>:<br \/>\n[groovy]<br \/>\n      # I am assuming that your root branch is master<br \/>\n      git checkout master<br \/>\n      git branch &#8211;merged<br \/>\n[\/groovy]<br \/>\n<\/p>\n<p>Above command will show you all branches which are already merged into the current branch (master branch in this case). This means you can delete these (feature) branches now.<br \/>\nFor deleting a branch on local: git branch {-d | D} &#8216;feature-branch-1&#8217;<br \/>\nFor deleting from remote: git push origin :feature-branch-1<br \/>\nI assumed that origin is your remote.<\/p>\n<p>Similarly if you run<br \/>\n[groovy]<br \/>\n      git branch &#8211;no-merged<br \/>\n[\/groovy]<br \/>\nIt will give a list of branches which are yet to be merged.<\/p>\n<p>\n<b>Question<\/b>: I got a list of branches which are not merged yet. Now I want to see the commits in particular branch which are not merged into root branch yet?<br \/>\n<b>Solution<\/b>:<br \/>\n[groovy]<br \/>\n      git log &#8211;pretty=oneline maser..branch1<br \/>\n[\/groovy]<br \/>\nAgain, master is your root branch. And branch1 is your feature branch having commits yet to be merged.<\/p>\n<p>Your comments are always Welcome. Please post if you have any!<\/p>\n<p>Cheers!<br \/>\nSalil Kalia<br \/>\nSalil [at] IntelliGrape [dot] com<br \/>\nTwitter LinkedIn <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches). By practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\/tested &#8211; they are merged back into the same root branch. [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":3,"footnotes":""},"categories":[7],"tags":[375,387],"class_list":["post-3208","post","type-post","status-publish","format-standard","hentry","category-grails","tag-git","tag-git-branching"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches). By practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\/tested - they are merged back into the same root branch.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Salil\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"git branching model: choose branches for deletion \u2013 see whats remaining for the merge | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches). By practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\/tested - they are merged back into the same root branch.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"git branching model: choose branches for deletion \u2013 see whats remaining for the merge | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches). By practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\/tested - they are merged back into the same root branch.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/#article\",\"name\":\"git branching model: choose branches for deletion \\u2013 see whats remaining for the merge | TO THE NEW Blog\",\"headline\":\"git branching model: choose branches for deletion &#8211; see whats remaining for the merge\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/salil\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2011-03-04T01:35:24+05:30\",\"dateModified\":\"2016-12-19T15:30:06+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/#webpage\"},\"articleSection\":\"Grails, git, git branching\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"position\":2,\"name\":\"Grails\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/#listItem\",\"name\":\"git branching model: choose branches for deletion &#8211; see whats remaining for the merge\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/#listItem\",\"position\":3,\"name\":\"git branching model: choose branches for deletion &#8211; see whats remaining for the merge\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/salil\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/salil\\\/\",\"name\":\"Salil\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/97e216cba95b296d5909ad7b93d1c338d0fdad7b95410c9412b126a90f4735d9?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Salil\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/\",\"name\":\"git branching model: choose branches for deletion \\u2013 see whats remaining for the merge | TO THE NEW Blog\",\"description\":\"This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches). By practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\\\/tested - they are merged back into the same root branch.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/salil\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/salil\\\/#author\"},\"datePublished\":\"2011-03-04T01:35:24+05:30\",\"dateModified\":\"2016-12-19T15:30:06+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"git branching model: choose branches for deletion \u2013 see whats remaining for the merge | TO THE NEW Blog","description":"This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches). By practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\/tested - they are merged back into the same root branch.","canonical_url":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/#article","name":"git branching model: choose branches for deletion \u2013 see whats remaining for the merge | TO THE NEW Blog","headline":"git branching model: choose branches for deletion &#8211; see whats remaining for the merge","author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/salil\/#author"},"publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"},"datePublished":"2011-03-04T01:35:24+05:30","dateModified":"2016-12-19T15:30:06+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/#webpage"},"isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/#webpage"},"articleSection":"Grails, git, git branching"},{"@type":"BreadcrumbList","@id":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.tothenew.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/grails\/#listItem","name":"Grails"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/grails\/#listItem","position":2,"name":"Grails","item":"https:\/\/www.tothenew.com\/blog\/category\/grails\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/#listItem","name":"git branching model: choose branches for deletion &#8211; see whats remaining for the merge"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/#listItem","position":3,"name":"git branching model: choose branches for deletion &#8211; see whats remaining for the merge","previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/grails\/#listItem","name":"Grails"}}]},{"@type":"Organization","@id":"https:\/\/www.tothenew.com\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/www.tothenew.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.tothenew.com\/blog\/author\/salil\/#author","url":"https:\/\/www.tothenew.com\/blog\/author\/salil\/","name":"Salil","image":{"@type":"ImageObject","@id":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/97e216cba95b296d5909ad7b93d1c338d0fdad7b95410c9412b126a90f4735d9?s=96&d=mm&r=g","width":96,"height":96,"caption":"Salil"}},{"@type":"WebPage","@id":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/#webpage","url":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/","name":"git branching model: choose branches for deletion \u2013 see whats remaining for the merge | TO THE NEW Blog","description":"This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches). By practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\/tested - they are merged back into the same root branch.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/#breadcrumblist"},"author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/salil\/#author"},"creator":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/salil\/#author"},"datePublished":"2011-03-04T01:35:24+05:30","dateModified":"2016-12-19T15:30:06+05:30"},{"@type":"WebSite","@id":"https:\/\/www.tothenew.com\/blog\/#website","url":"https:\/\/www.tothenew.com\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"git branching model: choose branches for deletion \u2013 see whats remaining for the merge | TO THE NEW Blog","og:description":"This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches). By practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\/tested - they are merged back into the same root branch.","og:url":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/","og:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"git branching model: choose branches for deletion \u2013 see whats remaining for the merge | TO THE NEW Blog","twitter:description":"This post is for people who are already familiar with Git and work on multiple branches (esp. feature branches). By practice, feature branches are the branches created from a root branch (master or any other as per your branching model) and once feature is complete\/tested - they are merged back into the same root branch.","twitter:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"3208","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-30 08:15:00","updated":"2024-02-29 10:59:25","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\/category\/grails\/\" title=\"Grails\">Grails<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tgit branching model: choose branches for deletion \u2013 see whats remaining for the merge\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.tothenew.com\/blog"},{"label":"Grails","link":"https:\/\/www.tothenew.com\/blog\/category\/grails\/"},{"label":"git branching model: choose branches for deletion &#8211; see whats remaining for the merge","link":"https:\/\/www.tothenew.com\/blog\/git-branching-model-choose-branches-for-deletion-see-whats-remaining-for-the-merge\/"}],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/3208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=3208"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/3208\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=3208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=3208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=3208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}