3 个版本
0.1.3 | 2021年8月4日 |
---|---|
0.1.2 | 2021年1月29日 |
0.1.0 | 2020年10月17日 |
#5 in #rebase
32KB
694 行
目录
-
删除本地分支及其上游分支。
-
基于默认分支(通常是
origin/main
)创建一个新的分支。 -
推送分支,并设置上游(如果尚未设置)。
-
类似于
git merge origin/main
,但帮助您逐个解决冲突的提交,而不是像git merge
一样整体解决。
git-try-merge
类似于 git merge origin/main
,但帮助您逐个解决冲突的提交,而不是像 git merge
一样整体解决。
概述
git try-merge
# 1. Merge as many non-conflicting commits as possible under one merge commit
# (if any)
# 2. Merge the first conflicting commit alone
# (if any)
#
# Then you need to repeat the command `git try-merge` until your branch is
# fully updated.
#
# The point: all the conflicting commits will be merged one-by-one which will
# allow you to fully understand the reason of the conflict and solve them
# separately. (A bit like `git rebase` would do.)
在 Git 的 CLI 中没有真正的等效功能。这是最接近的
git fetch
git merge origin/main
# Then you will solve all the conflicts of all the commits in one commit,
# no matter how many commits are conflicting.
安装
cargo install git-tools --bin git-try-merge
git-fork
基于默认分支(通常是 origin/main
)创建一个新的分支。
概述
git fork new-branch
# This command will:
# - make sure there is no uncommitted changes (clean state)
# - fetch (update) origin/main (or your default branch)
# - create a new branch "new-branch" that will be based on origin/main
# - checkout on this new branch
大致相当于
git checkout main
git pull --ff-only
git checkout -b new-branch
实现说明
本地分支 main 不会被更新。实际上,您甚至不需要本地分支 main。Git 中的确切等效可能更像是这样
git fetch origin main
# <ensure manually no uncommitted changes are pending>
git branch -f new-branch origin/main
git checkout new-branch
安装
cargo install git-tools --bin git-fork
git-push2
推送分支,并设置上游(如果尚未设置)。
概述
git push2
这相当于
git push
# if it fails:
git push --set-upstream origin new-branch
安装
cargo install git-tools --bin git-push2
git-delete
删除本地分支及其上游分支。
概述
git delete new-branch
这相当于
git branch -d new-branch
git push origin :new-branch
安装
cargo install git-tools --bin git-delete
依赖项
~19MB
~410K SLoC