{"id":1423,"date":"2023-01-17T22:23:00","date_gmt":"2023-01-17T21:23:00","guid":{"rendered":"https:\/\/alessandromasciadri.com\/?p=1423"},"modified":"2023-01-17T22:39:53","modified_gmt":"2023-01-17T21:39:53","slug":"come-eliminare-un-git-local-branch","status":"publish","type":"post","link":"https:\/\/alessandromasciadri.com\/come-eliminare-un-git-local-branch\/","title":{"rendered":"Come eliminare un Git local branch"},"content":{"rendered":"\t\t<div data-akihiro-type=\"ama-post\" data-akihiro-id=\"1423\" class=\"akihiro akihiro-1423\" data-akihiro-post-type=\"post\">\n\t\t\t\t<div class=\"akihiro-element akihiro-element-69f92dd e-flex e-con-boxed e-con e-parent\" data-id=\"69f92dd\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"akihiro-element akihiro-element-7543d19 akihiro-widget akihiro-widget-text-editor\" data-id=\"7543d19\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>La gestione dei branch di sviluppo \u00e8 molto semplice ed intuitiva con Git e la cancellazione di un branch locale non \u00e8 eccezione. Il comando da lanciare per eliminare un branch locale \u00e8 il seguente:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-ea2527e akihiro-widget akihiro-widget-code-highlight\" data-id=\"ea2527e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>git branch -d [local-branch]<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-087f101 akihiro-widget akihiro-widget-text-editor\" data-id=\"087f101\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In alcuni casi Git potrebbe rifiutarsi di cancellare il local branch quando esso contiene dei commit che non sono stati oggetto di merge in un altro local branch o di push verso un repository remoto. Questo comportamento \u00e8 da considerarsi non come un ostacolo, ma una forma che protegge dalla inavvertita perdita di dati di commit.<\/p><p>Per\u00f2, nel caso in cui si voglia forzare la cancellazione di un local branch anche se contenente dei commit in stato unmerged o unpushed, si pu\u00f2 ricorrere al flag -D. Il comando sar\u00e0 quindi il seguente:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-bc9e4cf akihiro-widget akihiro-widget-code-highlight\" data-id=\"bc9e4cf\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>git branch -D [local-branch]<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-8bb829d akihiro-widget akihiro-widget-heading\" data-id=\"8bb829d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t<h3 class=\"akihiro-heading-title akihiro-size-default\">Elencare i git local branch<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-7d25b23 akihiro-widget akihiro-widget-text-editor\" data-id=\"7d25b23\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Prima di procedere alla cancellazione di un Git local branch pu\u00f2 tornare utile ottenerne un elenco al fine di individuarne il nome preciso. In questo caso il comando da lanciare \u00e8 il seguente:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-d27e137 akihiro-widget akihiro-widget-code-highlight\" data-id=\"d27e137\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>git branch<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>La gestione dei branch di sviluppo \u00e8 molto semplice ed intuitiva con Git e la cancellazione di un branch locale non \u00e8 eccezione. Il comando da lanciare per eliminare un branch locale \u00e8 il seguente: git branch -d [local-branch] In alcuni casi Git potrebbe rifiutarsi di cancellare il local branch quando esso contiene dei commit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[35],"class_list":["post-1423","post","type-post","status-publish","format-standard","hentry","category-programmazione","tag-git"],"_links":{"self":[{"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/posts\/1423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/comments?post=1423"}],"version-history":[{"count":10,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/posts\/1423\/revisions"}],"predecessor-version":[{"id":1438,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/posts\/1423\/revisions\/1438"}],"wp:attachment":[{"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/media?parent=1423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/categories?post=1423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/tags?post=1423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}