如果本地没有对应<branch>的分支,而在远端(<remote>)存在对应<branch>名称的分支,则git worktree add <path> <commit-ish>命令等价于git worktree add --track -b <branch> <path> <remote>/<branch>命令 如果本地存在对应<branch>的分支(即<branch>是现有分支的分支名),则git worktree add <path> <comm...
it would create a new remote branch with the name of the current local branch and then push the commits. However, when I tried to push, the default remote was set tobase_repoinstead ofrepo_1, despite the branch being created fromrepo...
remote: Total 954 (delta 386), reused 780 (delta 219), pack-reused 0 Receiving objects: 100% (954/954), 66.87 MiB | 45.17 MiB/s, done. Resolving deltas: 100% (386/386), done. 最后我得到的是一个空的worktree目录。之所以说它是空的,不是因为里面什么文件都没有,而是我们想要的多个branch...
我们还要在当前目录下创建一个.git文件,文件内容是以gitdir的形式指向我们的.bare文件夹(如果不理解 gitdir 的含义,请回看Git Worktree 大法真香) echo "gitdir: ./.bare" > .git 然后我们要编辑 .bare/config 文件,并修改[remote "origin"]内容,和下面内容保持一致(也就是添加第 6 行内容),这确保我们创...
●worktree:工作区,配置于$GIT_DIR/config.worktree 每个作用域都对应一个命令行选项:--system,--global,--local,--worktree 读取选项时,指定范围将仅从该范围内的文件中读取选项。编写选项时,指定范围将写入该范围内的文件,可以看这样的示例: 4. 常用设置 ...
/.bare # 1$ git worktree add --track ../my-awesome-branch -b my-awesome-branch # 2Preparing worktree (new branch 'my-awesome-branch')branch 'my-awesome-branch' set up to track 'main'.HEAD is now at 0db2467 <commit message>$ cd ../my-awesome-branch # 3 1.回到仓库 2.添加...
1.修改D:\Edenred\LISA\main\.git\worktrees\v5\gitdir文件中的路径 2.修改D:\Edenred\LISA\v5\.git文件中的路径 Git add a worktree from existing remote branch TL;DR: you probably wantedgit worktree add ../north north git worktree add ../dev-bak dev-bak...
git worktree 命令允许你同时使用和/或管理多个工作树。 那么什么是工作树呢?你已经在使用一个,只是你可能不知道。或者你可以将其称为“工作副本”。 当你以经典方式克隆存储库(或使用创建新存储库git init)时,git 将创建所谓的“主工作树”: 1..git它克隆文件夹中的“裸”存储库 ...
然后我们要编辑 .bare/config 文件,并修改 [remote "origin"]内容,和下面内容保持一致(也就是添加第 6 行内容),这确保我们创建 worktree 切换分支,可以显示正确的分支名称 vim .bare/config # --- [remote "origin"] url = git@:FraserYu/amend-crash-demo.git fetch...
[remote "origin"] url = git@github.com:FraserYu/amend-crash-demo.git fetch = +refs/heads/*:refs/remotes/origin/* 接下来我们就可以创建 worktree 了,首先我们要为 main 分支创建 worktree,因为 main 分支 HEAD 的指向的 commit-ish 就是你创建其他 worktree 的 commit-ish ...