{"id":13722,"date":"2025-07-14T22:53:55","date_gmt":"2025-07-14T20:53:55","guid":{"rendered":"https:\/\/monodes.com\/predaelli\/?p=13722"},"modified":"2025-07-14T22:53:57","modified_gmt":"2025-07-14T20:53:57","slug":"rename-remote-branch-without-deleting-it","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2025\/07\/14\/rename-remote-branch-without-deleting-it\/","title":{"rendered":"Rename remote branch without deleting it"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/62084684\/rename-remote-branch-without-deleting-it\">Rename remote branch without deleting it<\/a><\/p>\n\n\n\n<p>Quick oneliner for <strong>deleting old branch<\/strong> and <strong>creating a new one with same content<\/strong> is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\" data-line=\"\">git push &lt;remote&gt; &lt;remote&gt;\/&lt;old&gt;:refs\/heads\/&lt;new&gt; :&lt;old&gt;\n<\/code><\/pre>\n\n\n\n<p>where <code class=\"\" data-line=\"\">remote<\/code> is obvious &#8211; e.g. origin, <code class=\"\" data-line=\"\">old<\/code> and <code class=\"\" data-line=\"\">new<\/code> are names of branches old and new respectively.<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2025\/07\/14\/rename-remote-branch-without-deleting-it\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federated","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[278],"tags":[51],"class_list":["post-13722","post","type-post","status-publish","format-standard","hentry","category-tricks","tag-git"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-3zk","jetpack-related-posts":[{"id":10940,"url":"https:\/\/monodes.com\/predaelli\/2023\/11\/03\/versioning-data-in-postgres-testing-a-git-like-approach-specfy\/","url_meta":{"origin":13722,"position":0},"title":"Versioning data in Postgres? Testing a git like approach &#8211; Specfy","author":"Paolo Redaelli","date":"2023-11-03","format":false,"excerpt":"Versioning data in Postgres? Testing a git like approach - Specfy is fashinating but I think that most of the time these two proposed alternatives fit most of the needs: In-Table versioning, the Wordpress way of doing thing. Add a a column version (or modify date) and SELECT the maximum\u2026","rel":"","context":"In &quot;Tricks&quot;","block_context":{"text":"Tricks","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/tricks\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3631,"url":"https:\/\/monodes.com\/predaelli\/2018\/01\/09\/3631\/","url_meta":{"origin":13722,"position":1},"title":"I couldn&#x27;t believe I&#x27;ve been\u2026","author":"Paolo Redaelli","date":"2018-01-09","format":"status","excerpt":"I couldn't believe I've been so lame I got to get the hint from GitHub for something as plain as: git remote add origin git@github.com:tybor\/fixed-file-extractor.git git push -u origin master","rel":"","context":"In &quot;Mood&quot;","block_context":{"text":"Mood","link":"https:\/\/monodes.com\/predaelli\/category\/mood\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1518,"url":"https:\/\/monodes.com\/predaelli\/2016\/05\/11\/master-of-cracking\/","url_meta":{"origin":13722,"position":2},"title":"Master of cracking","author":"Paolo Redaelli","date":"2016-05-11","format":false,"excerpt":"It seems that I'm a master in breaking automated tests. Do you think I can count it as a proficiency? :) Liberty Eiffel automated tests (Bell branch) Last update: 2016-05-11 11:44:02 +0200 (CEST) git pull failed (1) cd \/Liberty && git fetch origin && git checkout bell && git merge\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"liberty-light","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2016\/05\/liberty-light-150x150-1.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1511,"url":"https:\/\/monodes.com\/predaelli\/2016\/05\/09\/1511\/","url_meta":{"origin":13722,"position":3},"title":"Testing time: git clone --single-branch\u2026","author":"Paolo Redaelli","date":"2016-05-09","format":"status","excerpt":"Testing time: git clone --single-branch -b bell Tybor@git.sv.gnu.org:\/srv\/git\/liberty-eiffel.git bell For real, this time. As usual Google and stackoverflow.com is faster than reading the man pages.","rel":"","context":"In &quot;Liberty Eiffel&quot;","block_context":{"text":"Liberty Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/liberty-eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":915,"url":"https:\/\/monodes.com\/predaelli\/2016\/01\/21\/find-and-restore-a-deleted-file-in-a-git-repository\/","url_meta":{"origin":13722,"position":4},"title":"Find and restore a deleted file in a Git repository","author":"Paolo Redaelli","date":"2016-01-21","format":false,"excerpt":"Use git log --diff-filter=D --summary to get all the commits which have deleted files and the files deleted;Use git checkout $commit~1 filename to restore the deleted file. Sorgente: Find and restore a deleted file in a Git repository - Stack Overflow","rel":"","context":"In &quot;Documentations&quot;","block_context":{"text":"Documentations","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2358,"url":"https:\/\/monodes.com\/predaelli\/2017\/04\/14\/x2go-remote-desktop-faster-than-vnc\/","url_meta":{"origin":13722,"position":5},"title":"X2Go, remote desktop faster than VNC","author":"Paolo Redaelli","date":"2017-04-14","format":false,"excerpt":"Sometimes VNC feels too slow, expecially other slow links. Enters X2Go - everywhere@home! X2Go enables you to access a graphical desktop of a computer over a low bandwidth (or high bandwidth) connection.X2Go is a Remote Desktop solution, which some vendors vaguely call Remote Control. This is not to be confused\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/monodes.com\/predaelli\/category\/software\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/13722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=13722"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/13722\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=13722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=13722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=13722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}