Skip to content

Comments

feat: add force push support to push command#69

Merged
genedna merged 6 commits intoweb3infra-foundation:mainfrom
yxrxy:main
Nov 27, 2025
Merged

feat: add force push support to push command#69
genedna merged 6 commits intoweb3infra-foundation:mainfrom
yxrxy:main

Conversation

@yxrxy
Copy link
Contributor

@yxrxy yxrxy commented Nov 25, 2025

Fixes #68

功能:添加--force参数,当本地分支历史领先但存在提交改写时,强制将本地分支推送到远程并覆盖对应分支

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/-f CLI flag to enable force push operations
  • Implements is_ancestor function 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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

@yxrxy
Copy link
Contributor Author

yxrxy commented Nov 26, 2025

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

当前暂无法实现 push 的集成测试,缺少真实的 HTTP 请求环境,目前pull,push的测试目录都是空的

@genedna genedna merged commit b0c2376 into web3infra-foundation:main Nov 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[r2cn-测试任务] 为libra push命令添加--force参数,支持强制推送

2 participants