没有不值得去解决的问题,也没有不值得去学习的技术!

Perform a Rebase in TortoiseGit

The main part is step 3. After step 2 is complete, pull the code again, mainly to get the updates from the upstream branch. In TortoiseGit, select TortoiseGit - Rebase. The branch is the current local branch, and the upstream is the remote branch

1. Run the command: git pull origin feature/theme-store –rebase to use the rebase operation.

Plaintext

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 to stash the changes.

Plaintext

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. Run the rebase command again.

Plaintext

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 stash and immediately drop it from the stack. Merging the code causes conflicts.

Plaintext

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 ..." 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 ..." to unstage)
  (use "git add ..." to mark resolution)
        both modified:   platform/composer.json
        both modified:   platform/composer.lock

Untracked files:
  (use "git add ..." 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, perform a Git commit. The conflicting files are platform/composer.json and platform/composer.lock. See Figure 1.

In TortoiseGit, perform a Git commit. The conflicting files are platform/composer.json and platform/composer.lock.
Figure 1

6. Right-click the conflicting files and resolve the conflicts using “HEAD”. See Figure 2.

Right-click the conflicting files and resolve the conflicts using "HEAD"
Figure 2

7. Are you sure you want to mark the conflicted files as resolved? Simply click the Yes button. See Figure 3.

Are you sure you want to mark the conflicted files as resolved? Simply click the Yes button
Figure 3

8. Run git status. You can see that there are no longer any conflicts.

Plaintext

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 ..." 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 rebase operation is complete.

Plaintext

PS E:\wwwroot\object> git log
commit f6709bcf51c8b95bba96f241ae369ed58d7ca585 (HEAD -> feature/theme-store-wangqiang-20220215, origin/feature/theme-store)
Author: Vidy Videni 
Date:   Thu Feb 17 09:21:26 2022 +0800

    Add color background type

commit 7cf1c1f9ac44eec2fddd2ed67984bc41d3062409
Author: Vidy Videni 
Date:   Tue Feb 15 16:43:21 2022 +0800

    Install orchestra asset packages

commit a55b3dec62c63305476af07fc46fe82554e13a87
Author: Vidy Videni 
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 
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 perform the corresponding operations for steps 2 to 4 in TortoiseGit. For steps 2 and 4, refer to: Using the stash operation in TortoiseGit.

11. The main part is step 3. After step 2 is complete, pull the code again, mainly to get the updates from the upstream branch. In TortoiseGit, select TortoiseGit – Rebase. The branch is the current local branch, and the upstream is the remote branch. See Figure 4.

The main part is step 3. After step 2 is complete, pull the code again, mainly to get the updates from the upstream branch. In TortoiseGit, select TortoiseGit - Rebase. The branch is the current local branch, and the upstream is the remote branch
Figure 4
Plaintext
git.exe checkout -f 1150e89205303e353ae0aab7cfcf045c2255b515 --
Start rebasing

Picking 1: c9ea3f15ae0cfb4fa863053d9a30d8da6a7bcb71
feat: In the Get Theme Basic Info interface, add the field: themeAsset (get theme asset content)
[detached HEAD 38666ec8d] feat: In the Get Theme Basic Info interface, add the field: themeAsset (get theme asset content)
 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

Picking 2: 956b4341cd65d641bc35368c0a1f693d2083dc21
perf: Convert backslashes to forward slashes in theme asset paths
[detached HEAD 04a85bfe1] perf: Convert backslashes to forward slashes in theme asset paths
 Date: Thu Feb 17 11:35:16 2022 +0800
 1 file changed, 16 insertions(+), 14 deletions(-)

Picking 3: 85092d26901b1a731a888448168fc40a17ea75c2
test: In the Get Theme Basic Info interface, for the field: themeAsset (get theme asset content). Write tests
[detached HEAD 0eb9bf7b9] test: In the Get Theme Basic Info interface, for the field: themeAsset (get theme asset content). Write tests
 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. It meets expectations. See Figure 5.

Check the log, it meets expectations
Figure 5

13. If you need to keep the code from both branches during the rebase, you must resolve the conflicts first and then commit. See Figure 6.

If you need to keep the code from both branches during the rebase, you must resolve the conflicts first and then commit
Figure 6

14. Are you sure you want to mark the conflicted files as resolved? Yes. See Figure 7.

Are you sure you want to mark the conflicted files as resolved? Yes.
Figure 7

15. Click the Commit button again. See Figure 8.

Click the Commit button again
Figure 8

16. The current commit will be empty (e.g., due to conflict resolution). Skip this commit or keep only the commit message? Select Commit. See Figure 9.

The current commit will be empty (e.g., due to conflict resolution). Skip this commit or keep only the commit message? Select Commit
Figure 9

17. Rebase complete. See Figure 10.

Rebase complete
Figure 10

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系