{"thread":{"id":"64576","subject":"Copieing git repository to another disk is dangerous ! Especially in combination with remotes set to local repositories !","startedAt":"2025-12-04T03:59:21Z","lastAt":"2025-12-04T09:20:11Z","messageCount":3,"participants":["Skybuck Flying","Torsten Bögershausen","Konstantin Khomoutov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"531641","messageId":"AM0PR02MB44508B247E4B6EF4F387DA5FB3A6A@AM0PR02MB4450.eurprd02.prod.outlook.com","threadId":"64576","inReplyTo":null,"subject":"Copieing git repository to another disk is dangerous ! Especially in combination with remotes set to local repositories !","fromName":"Skybuck Flying","fromEmail":"skybuck2000@hotmail.com","sentAt":"2025-12-04T03:59:19Z","receivedAt":"2025-12-04T03:59:21Z","isPatch":false,"sender":{"key":"skybuck2000@hotmail.com","avatar":"https://gravatar.com/avatar/4ab663b18fe6174125b5b436538d435bbddad844433e1165b4d64363106e4114?d=mp&s=160"},"body":"First turn off auto-capitalization in windows 11 mail options->editor settings->auto capitalization.\n\nThen I can try and mystify you with proper commands:\n\nX:\ncd X:\\Vite\\Repository\\Mirror\ngit clone --mirror https://github.com/vitelabs/go-vite .\n\ncd X:\\Vite\\Branch\\Develop\\Delphi\ngit clone -o Repository \"X:\\Vite\\Repository\\Mirror\" .\n\nNow copy the contents of this disk to a new disk... (virtual disks)\n\nRead down below why this is dangerous\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\nHere is the problem and even solution:\n\nLet's suppose this is copied to disk Z:\n\ngit remote -v will show:\n\nX:\\Vite\\Repository\\Mirror\n\nIn other words the remote is still pointing to the mirror on disk X !!!!\n\nAny clones on disk Z will commit to disk X, leading to a big mess !\n\nIt's the drive letter !\n\nIt must be updated/changed ?!\n\nWhich leads to the question:\n\nCan drive letters be avoided in git remotes ?\n\nUsing a powershell script the AI was also kinda stupid and nuked upstream/origin with changed drive path, leading to url loss but that is minor.\n\nAnyway the AI had a solution to sync things back up on Z:\n\nMy own steps first:\nCopy mirror from X: to Z:\nAdjust the remote to point to Z: instead of X:\n\nThen follow AI steps:\n\nStep 1: Fetch the latest remote state\n\ngit fetch Repository\n\nStep 2:  Stash any local changes and untracked files\nThis ensures nothing gets lost or overwritten:\ngit stash --include-untracked\n\nStep 3: Fast‑forward your local branch to the remote tip\ngit reset --hard Repository/Branch/Develop/Delphi\n•     This moves your local branch pointer to match the remote exactly.\nYour working tree will now reflect the remote commit b6ff41f28/whatever\n\nStep 4: Restore your stashed files if needed\ngit stash pop\n\nIf you had local edits or untracked files you wanted to keep, they’ll be reapplied here.\n\nIf conflicts appear, Git will mark them clearly so you can resolve.\n\nStep 5. Verify alignment\ngit log --oneline Branch/Develop/Delphi -n 5\ngit log --oneline Repository/Branch/Develop/Delphi -n 5\n\n→ Both should show the same commit history at the tip.\n\nThe slightly annoying thing is, this had to happen to 8 commits containing either large files or many many many thousands of files, fortunately my system is fast and git can handle and my system has lots of ram otherwise, OOPSIE.\n\nAnyway I discovered this problem earlier on... ppfffieww...\n\nAll these steps were tried out and it worked, proving it's now the same again, and indeed the files were identical locally and remote, but had to known for sure:\n\nZ:\\Vite\\Branch\\Develop\\Delphi>git log --oneline Branch/Develop/Delphi -n 5\nb6ff41f28 (HEAD -> Branch/Develop/Delphi, Repository/Branch/Develop/Delphi) AI System Prompts added.\na8b3415ed GoToDelphi mappings added, existing and missing.\na7a3bcc12 golang compiler/runtime source code added.\n7f8dfb45f vendor packages added.\nb6e5e7b6e Gemini 3.0 Pro fixes to Log15 and common\n\nZ:\\Vite\\Branch\\Develop\\Delphi>git log --oneline Repository/Branch/Develop/Delphi -n 5\nb6ff41f28 (HEAD -> Branch/Develop/Delphi, Repository/Branch/Develop/Delphi) AI System Prompts added.\na8b3415ed GoToDelphi mappings added, existing and missing.\na7a3bcc12 golang compiler/runtime source code added.\n7f8dfb45f vendor packages added.\nb6e5e7b6e Gemini 3.0 Pro fixes to Log15 and common\n\nZ:\\Vite\\Branch\\Develop\\Delphi>\n\n(In my case the drive letters where U: and X: but I changed it in this example to X and Z)\n\nGoodbye,\n  for now,\n    Skybuck Flying !"},{"id":"531643","messageId":"20251204051215.GA23486@tb-raspi4","threadId":"64576","inReplyTo":"AM0PR02MB44508B247E4B6EF4F387DA5FB3A6A@AM0PR02MB4450.eurprd02.prod.outlook.com","subject":"Re: Copieing git repository to another disk is dangerous ! Especially in combination with remotes set to local repositories !","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2025-12-04T05:12:15Z","receivedAt":"2025-12-04T05:12:23Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On Thu, Dec 04, 2025 at 03:59:19AM +0000, Skybuck Flying wrote:\n\n[Skip all the interesting stuff]\n> \n> Which leads to the question:\n> \n> Can drive letters be avoided in git remotes ?\n> \n\nI think so.\nSince a long time Windows supports an UNC path.\nThey start with a double backslash, followed by the\nserver and share:\n\n\\\\server\\share\\directory\\filename.txt\nSo when you do\nnet use z: \\\\server\\share\n\nyou can do\ngit clone //server/share/path-to-repo\ninstead of\ngit clone z:/path-to-repo\n\n(And git replaces '/' with '\\' internally.)\n\nI need to admit that this may be not well-known \nbut should work.\n"},{"id":"531649","messageId":"fgjktagigkapjtmx5mxxzkoll5krt6fvdhcsjhed6esalhabp3@famahk7xyaah","threadId":"64576","inReplyTo":"AM0PR02MB44508B247E4B6EF4F387DA5FB3A6A@AM0PR02MB4450.eurprd02.prod.outlook.com","subject":"Re: Copieing git repository to another disk is dangerous ! Especially in combination with remotes set to local repositories !","fromName":"Konstantin Khomoutov","fromEmail":"kostix@bswap.ru","sentAt":"2025-12-04T09:04:50Z","receivedAt":"2025-12-04T09:20:11Z","isPatch":false,"sender":{"key":"kostix@bswap.ru","avatar":null},"body":"On Thu, Dec 04, 2025 at 03:59:19AM +0000, Skybuck Flying wrote:\n\n[...]\n> X:\n> cd X:\\Vite\\Repository\\Mirror\n> git clone --mirror https://github.com/vitelabs/go-vite .\n> \n> cd X:\\Vite\\Branch\\Develop\\Delphi\n> git clone -o Repository \"X:\\Vite\\Repository\\Mirror\" .\n> \n> Now copy the contents of this disk to a new disk... (virtual disks)\n\n> git remote -v will show:\n> \n> X:\\Vite\\Repository\\Mirror\n> \n> In other words the remote is still pointing to the mirror on disk X !!!!\n\nI do not understand the problem: the command\n\n  git clone -o Repository \"X:\\Vite\\Repository\\Mirror\"\n  \nhas cloned the repository \"X:\\Vite\\Repository\\Mirror\", and so it is completely\nexpected that re so-called \"remote\" to which you gave the name \"Repository\"\nrecords the URL of the remote repository it points at exactly as it has been\nprovided by the user - with the drive letter in this case.\n\nIf you do not want this behavior, you might consider using UNC paths or\na reasonably recent (2010s, I think) addition to NTFS called \"junction points\"\nwhich allows you to mount an external drive \"on\" an empty filesysem folder -\nalmost UNIX-way, so to speak ;-) See the \"mountvol\" console command and [1].\n\n 1. https://serverfault.com/a/8871\n\n"}]}