1、执行命令:git pull origin feature/theme-store –rebase,使用变基操作
PS E:/wwwroot/wshop> git pull origin feature/theme-store --rebase error: cannot pull with rebase: You have unstaged changes. error: please commit or stash them.
2、运行 git stash push,贮藏修改。
PS E:/wwwroot/wshop> git stash push Saved working directory and index state WIP on theme-store-wangqiang-20220215: dcbbe12be Add default section content_for_layout to render section settings PS E:/wwwroot/wshop>
3、再次执行变基命令
PS E:/wwwroot/wshop> git pull origin feature/theme-store --rebase remote: Enumerating objects: 16, done. remote: Counting objects: 100% (16/16), done. remote: Compressing objects: 100% (13/13), done. remote: Total 28 (delta 3), reused 2 (delta 2), pack-reused 12 Unpacking objects: 100% (28/28), 93.32 KiB | 54.00 KiB/s, done. From https://git.papamk.com/xgrit/wshop * branch feature/theme-store -> FETCH_HEAD dcbbe12be..f6709bcf5 feature/theme-store -> origin/feature/theme-store Updating dcbbe12be..f6709bcf5 Fast-forward .../json_schema/types/color_background.json | 12 + .../Accessor/DelayedThemeSettingAccessor.php | 21 +- .../ThemeSetting/Schema/SettingTypeFactory.php | 1 + .../Schema/Types/ColorBackgroundType.php | 9 + .../Modules/ThemeSetting/View/ManagesTemplate.php | 5 +- platform/composer.json | 15 +- platform/composer.lock | 4901 ++++++++++++++++---- 7 files changed, 4150 insertions(+), 814 deletions(-) create mode 100644 platform/Modules/ThemeSetting/Resources/json_schema/types/color_background.json create mode 100644 platform/Modules/ThemeSetting/Schema/Types/ColorBackgroundType.php PS E:/wwwroot/wshop>
4、运行 git stash pop 来应用贮藏然后立即从栈上扔掉它。合并代码出现冲突。
PS E:/wwwroot/wshop> git stash pop Auto-merging platform/composer.lock CONFLICT (content): Merge conflict in platform/composer.lock Auto-merging platform/composer.json CONFLICT (content): Merge conflict in platform/composer.json The stash entry is kept in case you need it again. PS E:/wwwroot/wshop> git status On branch feature/theme-store-wangqiang-20220215 Your branch is ahead of 'origin/feature/theme-store-wangqiang-20220215' by 3 commits. (use "git push" to publish your local commits) Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: platform/.rnd modified: platform/app/Http/Kernel.php modified: platform/app/Http/Middleware/CurrentTheme.php modified: platform/app/Providers/AppServiceProvider.php modified: platform/app/Services/PluginService.php modified: platform/config/app.php modified: platform/config/modules.php modified: platform/phpunit.xml Unmerged paths: (use "git restore --staged <file>..." to unstage) (use "git add <file>..." to mark resolution) both modified: platform/composer.json both modified: platform/composer.lock Untracked files: (use "git add <file>..." to include in what will be committed) platform/composer.json.BASE.json platform/composer.json.LOCAL.json platform/composer.json.REMOTE.json PS E:/wwwroot/wshop>
5、在 TortoiseGit 中,Git 提交,存在冲突文件:platform/composer.json、platform/composer.lock。如图1
6、右键存在冲突文件,使用”HEAD”解决冲突。如图2
7、确定要将已冲突的文件标记为已解决吗?直接点击是按钮。如图3
8、运行 git status,可以看到已经不存在冲突
PS E:/wwwroot/wshop> git status On branch feature/theme-store-wangqiang-20220215 Your branch is ahead of 'origin/feature/theme-store-wangqiang-20220215' by 3 commits. (use "git push" to publish your local commits) Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: platform/.rnd modified: platform/app/Http/Kernel.php modified: platform/app/Http/Middleware/CurrentTheme.php modified: platform/app/Providers/AppServiceProvider.php modified: platform/app/Services/PluginService.php modified: platform/config/app.php modified: platform/config/modules.php modified: platform/phpunit.xml PS E:/wwwroot/wshop>
9、查看 Git 日志,变基操作已经完成。
PS E:/wwwroot/wshop> git log commit f6709bcf51c8b95bba96f241ae369ed58d7ca585 (HEAD -> feature/theme-store-wangqiang-20220215, origin/feature/theme-store) Author: Vidy Videni <vidy.videni@gmail.com> Date: Thu Feb 17 09:21:26 2022 +0800 Add color background type commit 7cf1c1f9ac44eec2fddd2ed67984bc41d3062409 Author: Vidy Videni <vidy.videni@gmail.com> Date: Tue Feb 15 16:43:21 2022 +0800 Install orchestra asset packages commit a55b3dec62c63305476af07fc46fe82554e13a87 Author: Vidy Videni <vidy.videni@gmail.com> Date: Tue Feb 15 15:51:40 2022 +0800 Allow empty for ThemeSettingAccessor commit dcbbe12be67a4defccfd444d45ba4eb67a363112 (origin/feature/theme-store-wangqiang-20220215, feature/theme-store) Author: Vidy Videni <vidy.videni@gmail.com> Date: Tue Feb 15 14:44:07 2022 +0800 Add default section content_for_layout to render section settings commit a017d01d10273043ed31673e0630196ff7ae65ca PS E:/wwwroot/wshop>
10、现在需要在 TortoiseGit 中实现第 2 – 4 步骤的相应操作。第2、4步骤可参考:在 TortoiseGit 中使用 stash 操作
11、主要是第 3 步骤,第 2 步骤执行完毕后,重新拉取代码,主要是获取上游分支的更新,在 TortoiseGit 中,TortoiseGit – 变基(rebase)。分支为当前本地分支,上游为远程分支。如图4
git.exe checkout -f 1150e89205303e353ae0aab7cfcf045c2255b515 -- 开始变基 选取 1: c9ea3f15ae0cfb4fa863053d9a30d8da6a7bcb71 feat: 在 获取主题基本信息 接口中,添加字段:themeAsset(获取主题素材的内容) [detached HEAD 38666ec8d] feat: 在 获取主题基本信息 接口中,添加字段:themeAsset(获取主题素材的内容) Date: Thu Feb 17 11:28:20 2022 +0800 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 platform/Modules/ThemeStore/Resolver/OnlineStoreTheme/ThemeAssetResolver.php 选取 2: 956b4341cd65d641bc35368c0a1f693d2083dc21 perf: 主题素材的路径,反斜杠转换为正斜杠 [detached HEAD 04a85bfe1] perf: 主题素材的路径,反斜杠转换为正斜杠 Date: Thu Feb 17 11:35:16 2022 +0800 1 file changed, 16 insertions(+), 14 deletions(-) 选取 3: 85092d26901b1a731a888448168fc40a17ea75c2 test: 在 获取主题基本信息 接口中,针对字段:themeAsset(获取主题素材的内容)。编写测试 [detached HEAD 0eb9bf7b9] test: 在 获取主题基本信息 接口中,针对字段:themeAsset(获取主题素材的内容)。编写测试 Date: Thu Feb 17 15:42:07 2022 +0800 1 file changed, 31 insertions(+) git.exe checkout -f -B feature/theme-store-wangqiang-20220215 0eb9bf7b994a73a739aff787da3f2ffcad193c3c -- git.exe reset --hard 0eb9bf7b994a73a739aff787da3f2ffcad193c3c --
12、查看日志,符合预期。如图5
13、如果在变基时,需要保留 2 个分支的代码,则需要解决冲突后,再提交。如图6
14、确定要将有冲突的文件标识为已解决吗?是。如图7
15、再点击提交按钮。如图8
16、当前提交将是空的 (例如,由于解决冲突)。跳过此提交或者只保留提交消息?选择提交。如图9
17、变基完成。如图10
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250860.html