Using the base operation in TortoiseGit

主要是第 3 步骤,第 2 步骤执行完毕后,重新拉取代码,主要是获取上游分支的更新,在 TortoiseGit 中,TortoiseGit - 变基(rebase)。分支为当前本地分支,上游为远程分支
1. Execute the command: git pull origin feature/theme-store –rebase, use the base operation


PS E:\wwwroot\object> git pull origin feature/theme-store --rebase
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.


2. Run git stash push, storage and modification.


PS E:\wwwroot\object> 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\object>


3. Execute the base command again


PS E:\wwwroot\object> 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://xxx.com/xxx/object
 * 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\object>


4. Run git stash pop to apply the storage and immediately throw it away from the stack. There is a conflict between the merge code.


PS E:\wwwroot\object> 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\object> 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\object>


5. In TortoiseGit, git submits, there is a conflicting file: platform/composer.json, platform/composer.lock. as shown in Figure 1
在 TortoiseGit 中,Git 提交,存在冲突文件:platform/composer.json、platform/composer.lock。
Figure 1
6. Right-click there is a conflict file, use “head” to resolve the conflict. as shown in Figure 2
右键存在冲突文件,使用&quot;HEAD&quot;解决冲突
Figure 2
7. Are you sure you want to mark the conflicting file as resolved? Click directly on the button. as shown in Figure 3
确定要将已冲突的文件标记为已解决吗?直接点击是按钮
Figure 3
8. Run git status, you can see that there is no conflict


PS E:\wwwroot\object> 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\object>


9. Check the git log, the base operation has been completed.


PS E:\wwwroot\object> 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\object>


10. Now you need to implement the corresponding operations of steps 2-4 in TortoiseGit. Steps 2 and 4 for reference: Using STASH in TortoiseGit 11. It is mainly the third step. After the second step is executed, the code is re-drawn, mainly to obtain the update of the upstream branch. The branch is the current local branch, and the upstream is the remote branch. as shown in Figure 4
主要是第 3 步骤,第 2 步骤执行完毕后,重新拉取代码,主要是获取上游分支的更新,在 TortoiseGit 中,TortoiseGit - 变基(rebase)。分支为当前本地分支,上游为远程分支
Figure 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. Check the log, in line with expectations. as shown in Figure 5
查看日志,符合预期
Figure 5
13. If you need to keep the code of 2 branches when changing the base, you need to resolve the conflict before submitting. as shown in Figure 6
如果在变基时,需要保留 2 个分支的代码,则需要解决冲突后,再提交
Figure 6
14. Are you sure you want to identify the conflicting file as resolved? Yes. as shown in Figure 7
确定要将有冲突的文件标识为已解决吗?是。
Figure 7
15. Click the submit button again. as shown in Figure 8
再点击提交按钮
8
16. The current commit will be empty (for example, due to conflict resolution). Skip this commit or just keep the commit message? Select Submit. as shown in Figure 9
当前提交将是空的 (例如,由于解决冲突)。跳过此提交或者只保留提交消息?选择提交
Figure 9
17. The transformation is completed. As shown in Figure 10
变基完成
Figure 10

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.