From 83772d304a7aeca4c0b940ee233731ac26b4cb82 Mon Sep 17 00:00:00 2001 From: Amolith Date: Fri, 6 Feb 2026 18:07:47 -0700 Subject: [PATCH] fix(clone): remove automatic push on clone Remove automatic push behavior after cloning repositories. Previously wt would push the default branch to configured remotes immediately after clone, which could create unwanted forks. Users can now push manually when ready. --- README.md | 5 ++--- dist/wt | 21 +++------------------ src/wt/cmd/clone.lua | 15 +-------------- src/wt/help.lua | 6 ++---- 4 files changed, 8 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index b5db79252f8dbcb61dbd9eae584967bc93d2481e..93bd3dfaf8a5767bfe5bc298bbc4468508e3cf3d 100644 --- a/README.md +++ b/README.md @@ -67,15 +67,14 @@ chmod +x ~/.local/bin/wt ``` wt c https://github.com/org/repo.git # origin → upstream, your remotes added from config -# Pushes default branch to ALL selected remotes (creates fork copies) ``` **Your own projects:** ``` wt c git@github.com:you/repo.git --own -# First selected remote becomes origin (no push to it) -# Pushes only to additional remotes (mirrors) +# First selected remote becomes origin +# Additional remotes added from config ``` ### Adding worktrees diff --git a/dist/wt b/dist/wt index 06a05907e88efafdf0745fad3b99439ea5d198f6..413b3a91360bee1fea9161c262fb9889ac81202e 100755 --- a/dist/wt +++ b/dist/wt @@ -840,18 +840,16 @@ M.COMMAND_HELP = { "Options:", " --remote Add configured remote from ~/.config/wt/config.lua", " Can be specified multiple times", - " --own Treat as your own project (see Push Behavior below)", + " --own Treat as your own project (see Remote Behavior below)", "", - "Push Behavior:", + "Remote Behavior:", " Contributor mode (default):", " - 'origin' renamed to 'upstream'", " - Selected remotes added from config", - " - Pushes default branch to ALL selected remotes (creates fork copies)", "", " Own mode (--own):", " - 'origin' renamed to first selected remote", " - Additional remotes added from config", - " - Pushes only to ADDITIONAL remotes (mirrors), not the first", "", "Examples:", " wt c https://github.com/user/repo.git", @@ -1160,13 +1158,6 @@ function M.cmd_clone(args) .. remote_name .. "/*'" ) - -- Push to additional remotes - output, code = shell.run_cmd( - "GIT_DIR=" .. git_dir .. " git push " .. remote_name .. " " .. default_branch - ) - if code ~= 0 then - io.stderr:write("warning: failed to push to " .. remote_name .. ": " .. output .. "\n") - end table.insert(configured_remotes, remote_name) end else @@ -1196,7 +1187,7 @@ function M.cmd_clone(args) table.insert(configured_remotes, "upstream") end - -- Add user's remotes and push to each + -- Add user's remotes local remotes = global_config.remotes for _, remote_name in ipairs(selected_remotes) do if remotes then @@ -1217,12 +1208,6 @@ function M.cmd_clone(args) .. remote_name .. "/*'" ) - -- Push to this remote - output, code = - shell.run_cmd("GIT_DIR=" .. git_dir .. " git push " .. remote_name .. " " .. default_branch) - if code ~= 0 then - io.stderr:write("warning: failed to push to " .. remote_name .. ": " .. output .. "\n") - end table.insert(configured_remotes, remote_name) end else diff --git a/src/wt/cmd/clone.lua b/src/wt/cmd/clone.lua index ed81cccb06955dd8ff5cb95f46a34171d395f07c..75f7bc64b12ae398cf9fc2bfdc16d1f8dd33d1cc 100644 --- a/src/wt/cmd/clone.lua +++ b/src/wt/cmd/clone.lua @@ -193,13 +193,6 @@ function M.cmd_clone(args) .. remote_name .. "/*'" ) - -- Push to additional remotes - output, code = shell.run_cmd( - "GIT_DIR=" .. git_dir .. " git push " .. remote_name .. " " .. default_branch - ) - if code ~= 0 then - io.stderr:write("warning: failed to push to " .. remote_name .. ": " .. output .. "\n") - end table.insert(configured_remotes, remote_name) end else @@ -229,7 +222,7 @@ function M.cmd_clone(args) table.insert(configured_remotes, "upstream") end - -- Add user's remotes and push to each + -- Add user's remotes local remotes = global_config.remotes for _, remote_name in ipairs(selected_remotes) do if remotes then @@ -250,12 +243,6 @@ function M.cmd_clone(args) .. remote_name .. "/*'" ) - -- Push to this remote - output, code = - shell.run_cmd("GIT_DIR=" .. git_dir .. " git push " .. remote_name .. " " .. default_branch) - if code ~= 0 then - io.stderr:write("warning: failed to push to " .. remote_name .. ": " .. output .. "\n") - end table.insert(configured_remotes, remote_name) end else diff --git a/src/wt/help.lua b/src/wt/help.lua index 7bee89ea30affc1f66f53ab8dd2389c3f3a99793..c3cbb5f080fc2895d5758f8f9a29e3684881bb93 100644 --- a/src/wt/help.lua +++ b/src/wt/help.lua @@ -38,18 +38,16 @@ M.COMMAND_HELP = { "Options:", " --remote Add configured remote from ~/.config/wt/config.lua", " Can be specified multiple times", - " --own Treat as your own project (see Push Behavior below)", + " --own Treat as your own project (see Remote Behavior below)", "", - "Push Behavior:", + "Remote Behavior:", " Contributor mode (default):", " - 'origin' renamed to 'upstream'", " - Selected remotes added from config", - " - Pushes default branch to ALL selected remotes (creates fork copies)", "", " Own mode (--own):", " - 'origin' renamed to first selected remote", " - Additional remotes added from config", - " - Pushes only to ADDITIONAL remotes (mirrors), not the first", "", "Examples:", " wt c https://github.com/user/repo.git",