{"id":38347,"date":"2016-06-17T11:00:48","date_gmt":"2016-06-17T08:00:48","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=38347"},"modified":"2022-11-15T14:47:45","modified_gmt":"2022-11-15T12:47:45","slug":"git-delete-local-branch-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/","title":{"rendered":"Git Delete Local Branch Example"},"content":{"rendered":"<p>In this example, we shall learn how to delete Git local branch. To delete a branch, it must be fully merged in its upstream branch, or in HEAD if no upstream was set.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-1-a-brief-on-git-branch\">1. A brief on Git branch<\/h2>\n<p>A branch represents an independent line of development. These serve as an abstraction for the edit, stage, or commit process.<\/p>\n<p>The <code>git branch<\/code> command lets you create, list, rename, and delete branches. <code>git branch<\/code> is tightly integrated with the <code>git checkout<\/code> and <code>git merge<\/code> commands.<\/p>\n<p>Usage of <code>git branch<\/code> command:<\/p>\n<pre class=\"wp-block-preformatted\">git branch [--color[=] | --no-color] [-r | -a]\n\t[--list] [-v [--abbrev= | --no-abbrev]]\n\t[--column[=] | --no-column]\n\t[(--merged | --no-merged | --contains) []] [--sort=]\n\t[--points-at ] [\u2026]\ngit branch [--set-upstream | --track | --no-track] [-l] [-f]  []\ngit branch (--set-upstream-to= | -u ) []\ngit branch --unset-upstream []\ngit branch (-m | -M) [] \ngit branch (-d | -D) [-r] \u2026\ngit branch --edit-description []\n<\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-2-create-a-git-repository\">2. Create a Git Repository<\/h2>\n<p>To see our example in action, we shall start with creating a git repository.<\/p>\n<p>First, we shall create a directory for the master branch.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-directory-for-initializing-Git-branch.jpg\"><img decoding=\"async\" width=\"584\" height=\"363\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-directory-for-initializing-Git-branch.jpg\" alt=\"Create directory for initializing Git branch\" class=\"wp-image-38358\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-directory-for-initializing-Git-branch.jpg 584w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-directory-for-initializing-Git-branch-300x186.jpg 300w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><\/a><figcaption class=\"wp-element-caption\">Create a directory for initializing the Git branch<\/figcaption><\/figure>\n<\/div>\n<p>Here, we shall initialize the git repository using the <code>git init<\/code> command.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Initialize-Git-repository.jpg\"><img decoding=\"async\" width=\"583\" height=\"362\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Initialize-Git-repository.jpg\" alt=\"Initialize Git repository\" class=\"wp-image-38359\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Initialize-Git-repository.jpg 583w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Initialize-Git-repository-300x186.jpg 300w\" sizes=\"(max-width: 583px) 100vw, 583px\" \/><\/a><figcaption class=\"wp-element-caption\">Initialize Git repository<\/figcaption><\/figure>\n<\/div>\n<p>Once we have initialized the Git repository, we shall add some files and then add and commit using <code>git add<\/code> and <code>git commit<\/code> command respectively.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Add-and-commit-file-to-repository.jpg\"><img decoding=\"async\" width=\"582\" height=\"365\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Add-and-commit-file-to-repository.jpg\" alt=\"Add and commit file to repository\" class=\"wp-image-38360\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Add-and-commit-file-to-repository.jpg 582w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Add-and-commit-file-to-repository-300x188.jpg 300w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><\/a><figcaption class=\"wp-element-caption\">Add and commit the file to the repository<\/figcaption><\/figure>\n<\/div>\n<p>Now that we have created a master branch, now we shall be creating a directory where we will create a new local branch.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-directory-for-new-branch.jpg\"><img decoding=\"async\" width=\"584\" height=\"362\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-directory-for-new-branch.jpg\" alt=\"Create directory for new branch\" class=\"wp-image-38361\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-directory-for-new-branch.jpg 584w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-directory-for-new-branch-300x186.jpg 300w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><\/a><figcaption class=\"wp-element-caption\">Create a directory for a new branch<\/figcaption><\/figure>\n<\/div>\n<p>In this directory, we shall clone the git master branch that we just created using the command <code>git clone<\/code>.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Clone-master-branch.jpg\"><img decoding=\"async\" width=\"579\" height=\"362\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Clone-master-branch.jpg\" alt=\"Clone master branch\" class=\"wp-image-38362\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Clone-master-branch.jpg 579w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Clone-master-branch-300x188.jpg 300w\" sizes=\"(max-width: 579px) 100vw, 579px\" \/><\/a><figcaption class=\"wp-element-caption\">Clone master branch<\/figcaption><\/figure>\n<\/div>\n<p>Here, let&#8217;s create a new branch <i>ReleaseBranch<\/i> using the command <code>git branch &lt;branch name&gt;<\/code>. Available branches can be viewed using the command <code>git branch<\/code>.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-new-branch.jpg\"><img decoding=\"async\" width=\"585\" height=\"362\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-new-branch.jpg\" alt=\"Create new branch\" class=\"wp-image-38363\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-new-branch.jpg 585w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Create-new-branch-300x186.jpg 300w\" sizes=\"(max-width: 585px) 100vw, 585px\" \/><\/a><figcaption class=\"wp-element-caption\">Create new branch<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-3-git-delete-local-branch-in-action\">3. Git delete local branch in Action<\/h2>\n<p>Now assume that all the work with the local branch is now complete and we now want to delete the same. For this purpose, we will use the command <code>git branch -d &lt;branch name&gt;<\/code>.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Delete-local-branch.jpg\"><img decoding=\"async\" width=\"582\" height=\"364\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Delete-local-branch.jpg\" alt=\"Delete local branch\" class=\"wp-image-38364\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Delete-local-branch.jpg 582w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Delete-local-branch-300x188.jpg 300w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><\/a><figcaption class=\"wp-element-caption\">Delete local branch<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-3-1-d-d-option\">3.1 -d \/ -D option<\/h3>\n<p>The <code>-d<\/code> option will delete the branch only if it has already been pushed and merged with the remote branch. We can also use <code>-D<\/code> option (in Uppercase) if we want to forcefully delete the branch. <code>-d<\/code> is a shortcut of <code>--delete<\/code>. <code>-D<\/code> is a shortcut of <code>--delete --force<\/code>[ulp id=&#8217;pzgfvmZhgslwSymm&#8217;]<\/p>\n<p>Let&#8217;s create a new branch:<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n~\/study\/github\/MockRestServiceServerExample$ git branch test-branch\n<\/pre>\n<\/div>\n<p>Test branch has been created:<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n~\/study\/github\/MockRestServiceServerExample$ git branch\n* master\n  test-branch\n<\/pre>\n<\/div>\n<p>Switch to the new branch:<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n~\/study\/github\/MockRestServiceServerExample$ git checkout test-branch\nSwitched to branch &#039;test-branch&#039;\n<\/pre>\n<\/div>\n<p>Make a modification and commit the changes to the local branch. Don&#8217;t push the changes in the remote repository:<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n~\/study\/github\/MockRestServiceServerExample$ git commit -am &quot;test branch deletion&quot;\n&#x5B;test-branch 93b8f82] test branch deletion\n 1 file changed, 1 insertion(+), 1 deletion(-)\n<\/pre>\n<\/div>\n<p>Switch to a different branch:<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n~\/study\/github\/MockRestServiceServerExample$ git checkout master\nSwitched to branch &#039;master&#039;\nYour branch is up to date with &#039;origin\/master&#039;.\n<\/pre>\n<\/div>\n<p>Now try to delete the previous branch with a <code>-d<\/code> option:<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n~\/study\/github\/MockRestServiceServerExample$ git branch -d test-branch\nerror: The branch &#039;test-branch&#039; is not fully merged.\nIf you are sure you want to delete it, run &#039;git branch -D test-branch&#039;.\n<\/pre>\n<\/div>\n<p>As we can see we can&#8217;t delete the branch because there are local changes in the local branch which are not pushed in the remote repository. Now try to delete the branch using a <code>-D<\/code> option.<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n~\/study\/github\/MockRestServiceServerExample$ git branch -D test-branch\nDeleted branch test-branch (was 93b8f82).\n<\/pre>\n<\/div>\n<p>We can see that the branch gets deleted.<\/p>\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-12-at-14.14.28.png\"><img decoding=\"async\" width=\"840\" height=\"473\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-12-at-14.14.28.png\" alt=\"\" class=\"wp-image-116476\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-12-at-14.14.28.png 840w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-12-at-14.14.28-300x169.png 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-12-at-14.14.28-768x432.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/a><figcaption class=\"wp-element-caption\">-d and _d options<\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\" id=\"h-4-conclusion\">4. Conclusion<\/h2>\n<p>In this example, we learned the usage of <code>git branch<\/code> command to delete the local branch.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this example, we shall learn how to delete Git local branch. To delete a branch, it must be fully merged in its upstream branch, or in HEAD if no upstream was set. 1. A brief on Git branch A branch represents an independent line of development. These serve as an abstraction for the edit, &hellip;<\/p>\n","protected":false},"author":75,"featured_media":27377,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1353],"tags":[1454,1508,1509,1510,1453],"class_list":["post-38347","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-git","tag-distributed-version-control","tag-git-branch","tag-git-branch-delete","tag-git-delete-local-branch","tag-version-control"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Git Delete Local Branch Example - Examples Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this example, we shall learn how to delete Git local branch. To delete a branch, it must be fully merged in its upstream branch, or in HEAD if no\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git Delete Local Branch Example - Examples Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this example, we shall learn how to delete Git local branch. To delete a branch, it must be fully merged in its upstream branch, or in HEAD if no\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-17T08:00:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-15T12:47:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Saurabh Arora\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Saurabh Arora\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/\"},\"author\":{\"name\":\"Saurabh Arora\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5bf4e0274824642c44536b83ddbfaf6c\"},\"headline\":\"Git Delete Local Branch Example\",\"datePublished\":\"2016-06-17T08:00:48+00:00\",\"dateModified\":\"2022-11-15T12:47:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/\"},\"wordCount\":433,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"keywords\":[\"distributed version control\",\"git branch\",\"git branch delete\",\"git delete local branch\",\"version control\"],\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/\",\"name\":\"Git Delete Local Branch Example - Examples Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"datePublished\":\"2016-06-17T08:00:48+00:00\",\"dateModified\":\"2022-11-15T12:47:45+00:00\",\"description\":\"In this example, we shall learn how to delete Git local branch. To delete a branch, it must be fully merged in its upstream branch, or in HEAD if no\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Software Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/software-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/software-development\/git\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Git Delete Local Branch Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5bf4e0274824642c44536b83ddbfaf6c\",\"name\":\"Saurabh Arora\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Saurabh-Arora-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Saurabh-Arora-96x96.jpg\",\"caption\":\"Saurabh Arora\"},\"description\":\"Saurabh graduated with an engineering degree in Information Technology from YMCA Institute of Engineering, India. He is SCJP, OCWCD certified and currently working as Technical Lead with one of the biggest service based firms and is involved in projects extensively using Java and JEE technologies. He has worked in E-Commerce, Banking and Telecom domain.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\",\"https:\/\/in.linkedin.com\/in\/saurabh-arora-78674b18\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/saurabh-arora\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git Delete Local Branch Example - Examples Java Code Geeks","description":"In this example, we shall learn how to delete Git local branch. To delete a branch, it must be fully merged in its upstream branch, or in HEAD if no","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:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/","og_locale":"en_US","og_type":"article","og_title":"Git Delete Local Branch Example - Examples Java Code Geeks","og_description":"In this example, we shall learn how to delete Git local branch. To delete a branch, it must be fully merged in its upstream branch, or in HEAD if no","og_url":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-06-17T08:00:48+00:00","article_modified_time":"2022-11-15T12:47:45+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","type":"image\/jpeg"}],"author":"Saurabh Arora","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Saurabh Arora","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/"},"author":{"name":"Saurabh Arora","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5bf4e0274824642c44536b83ddbfaf6c"},"headline":"Git Delete Local Branch Example","datePublished":"2016-06-17T08:00:48+00:00","dateModified":"2022-11-15T12:47:45+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/"},"wordCount":433,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","keywords":["distributed version control","git branch","git branch delete","git delete local branch","version control"],"articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/","url":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/","name":"Git Delete Local Branch Example - Examples Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","datePublished":"2016-06-17T08:00:48+00:00","dateModified":"2022-11-15T12:47:45+00:00","description":"In this example, we shall learn how to delete Git local branch. To delete a branch, it must be fully merged in its upstream branch, or in HEAD if no","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-delete-local-branch-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Software Development","item":"https:\/\/examples.javacodegeeks.com\/category\/software-development\/"},{"@type":"ListItem","position":3,"name":"Git","item":"https:\/\/examples.javacodegeeks.com\/category\/software-development\/git\/"},{"@type":"ListItem","position":4,"name":"Git Delete Local Branch Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5bf4e0274824642c44536b83ddbfaf6c","name":"Saurabh Arora","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Saurabh-Arora-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Saurabh-Arora-96x96.jpg","caption":"Saurabh Arora"},"description":"Saurabh graduated with an engineering degree in Information Technology from YMCA Institute of Engineering, India. He is SCJP, OCWCD certified and currently working as Technical Lead with one of the biggest service based firms and is involved in projects extensively using Java and JEE technologies. He has worked in E-Commerce, Banking and Telecom domain.","sameAs":["http:\/\/www.javacodegeeks.com\/","https:\/\/in.linkedin.com\/in\/saurabh-arora-78674b18"],"url":"https:\/\/examples.javacodegeeks.com\/author\/saurabh-arora\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/38347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=38347"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/38347\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/27377"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=38347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=38347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=38347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}