feat: add force push support to push command#69
Merged
genedna merged 6 commits intoweb3infra-foundation:mainfrom Nov 27, 2025
Merged
feat: add force push support to push command#69genedna merged 6 commits intoweb3infra-foundation:mainfrom
genedna merged 6 commits intoweb3infra-foundation:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds force push support to the push command, implementing the ability to override remote history when local and remote branches have diverged. The implementation adds a --force flag and includes an ancestor checking mechanism to determine if a push requires force mode.
Key changes:
- Adds
--force/-fCLI flag to enable force push operations - Implements
is_ancestorfunction using BFS to check for fast-forward compatibility - Improves error handling for missing branches
- Updates remote tracking branches after successful push
- Adds test coverage for force flag parsing
Contributor
Author
当前暂无法实现 push 的集成测试,缺少真实的 HTTP 请求环境,目前pull,push的测试目录都是空的 |
genedna
approved these changes
Nov 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #68
功能:添加--force参数,当本地分支历史领先但存在提交改写时,强制将本地分支推送到远程并覆盖对应分支