{"id":3633,"date":"2026-07-17T17:41:11","date_gmt":"2026-07-17T21:41:11","guid":{"rendered":"https:\/\/krishengreenwell.com\/blog\/?p=3633"},"modified":"2026-07-17T17:42:28","modified_gmt":"2026-07-17T21:42:28","slug":"the-sync-button-isnt-lying-to-you-your-branch-is","status":"publish","type":"post","link":"https:\/\/krishengreenwell.com\/blog\/the-sync-button-isnt-lying-to-you-your-branch-is\/","title":{"rendered":"The &#8220;Sync&#8221; Button Isn&#8217;t Lying to You \u2014 Your Branch Is"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/krishengreenwell.com\/blog\/wp-content\/uploads\/2026\/07\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/krishengreenwell.com\/blog\/wp-content\/uploads\/2026\/07\/image.png\" alt=\"\" class=\"wp-image-3635\" srcset=\"https:\/\/krishengreenwell.com\/blog\/wp-content\/uploads\/2026\/07\/image.png 1024w, https:\/\/krishengreenwell.com\/blog\/wp-content\/uploads\/2026\/07\/image-300x300.png 300w, https:\/\/krishengreenwell.com\/blog\/wp-content\/uploads\/2026\/07\/image-150x150.png 150w, https:\/\/krishengreenwell.com\/blog\/wp-content\/uploads\/2026\/07\/image-768x768.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I nearly shipped six commits straight to a shared branch a teammate was actively building on \u2014 with nothing more dramatic than one click of VS Code&#8217;s &#8220;Sync&#8221; button, on a branch I was sure was my own.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The cause:&nbsp;<code>origin\/shared-branch<\/code>&nbsp;in&nbsp;<code>git checkout -b my-fix origin\/shared-branch<\/code>&nbsp;is obviously the starting point for the new branch&#8217;s history \u2014 but by default, git also treats it as the branch&#8217;s upstream, meaning&nbsp;<code>my-fix<\/code>&nbsp;becomes an alias for&nbsp;<code>origin\/shared-branch<\/code>&nbsp;for push purposes, even as its own commits diverge locally. The local name is cosmetic; the tracking relationship is what actually decides where &#8220;Sync&#8221; sends your commits, and from that moment, every Sync pushed straight to the shared branch. The tell in hindsight: a brand-new branch should show&nbsp;<strong>&#8220;Publish Branch,&#8221;<\/strong>&nbsp;not&nbsp;<strong>&#8220;Sync.&#8221;<\/strong>&nbsp;Seeing Sync on something I&#8217;d just created was the red flag I missed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Cleaning up:<\/strong>&nbsp;resist force-push on a shared branch \u2014 someone may have already fetched it. Instead: push the commits to their own branch,&nbsp;<code>git revert<\/code>&nbsp;them on the shared branch (adds undo-commits instead of rewriting history), then cherry-pick the same commits onto a fresh branch off the now-reverted tip and open a normal PR. A few extra minutes, zero rewritten history.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The real fix<\/strong>&nbsp;\u2014 stop relying on catching it in the moment:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git config branch.autoSetupMerge false<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This disables git&#8217;s default auto-tracking whenever a branch is created from a remote ref \u2014 the exact mechanism behind the mistake. Every new branch now starts with no upstream at all, so &#8220;Publish Branch&#8221; always appears first, forcing a conscious choice before anything gets pushed anywhere.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When a tool does exactly what it&#8217;s configured to do, the fix isn&#8217;t &#8220;be more careful&#8221; \u2014 it&#8217;s changing the configuration so the mistake can&#8217;t happen again.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I nearly shipped six commits straight to a shared branch a teammate was actively building on \u2014 with nothing more dramatic than one click of VS Code&#8217;s &#8220;Sync&#8221; button, on a branch I was sure was my own. The cause:&nbsp;origin\/shared-branch&nbsp;in&nbsp;git checkout -b my-fix origin\/shared-branch&nbsp;is obviously the starting point for the new branch&#8217;s history \u2014 but [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3635,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3633","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/posts\/3633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/comments?post=3633"}],"version-history":[{"count":2,"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/posts\/3633\/revisions"}],"predecessor-version":[{"id":3636,"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/posts\/3633\/revisions\/3636"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/media\/3635"}],"wp:attachment":[{"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/media?parent=3633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/categories?post=3633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/krishengreenwell.com\/blog\/wp-json\/wp\/v2\/tags?post=3633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}