Note di Hongmu

git rebase

将 commits 从一个分支合并到另一个分支上。 常用于跨分支的 commits 合并,在被合并分支的最头部构建新的 `commit`,表示合并完成

100% Elaborazione locale nel browser 0 Caricamento dei dati

Esempi comuni

在另一个分支的头节点合并当前分支

git rebase {{目标分支}}

启动交互式的合并任务,允许对提交的内容进行重新排序、省略、合并或修改

git rebase {{[-i|--interactive]}} {{目标分支或 commit 的 hash}}

处理完冲突文件后,继续执行合并任务

git rebase --continue

跳过冲突文件,继续执行合并任务

git rebase --skip

终止正在执行中的合并任务(例如:对于正处于解决冲突中的任务,将其打断,恢复到合并前的状态)

git rebase --abort

将分支的部分 commits 生成新的 `commit`,移动到新分支的头节点

git rebase --onto {{目标分支}} {{当前分支}}

启动交互式的合并任务,对最近提交的 5 个 commits 进行重新排序、省略、合并或修改

git rebase {{[-i|--interactive]}} HEAD~5

以当前分支优先的策略,自动处理分支间的冲突,执行合并

git rebase {{[-X|--strategy-option]}} theirs {{分支名称}}

Suggerimento: parentesi graffe{{…}}È il parametro da sostituire (percorso, nome file, ecc.); il comando viene eseguito solo nel terminale locale e questo sito non salva alcun input.

Confronto del testo originale inglese

Espandi istruzioni ed esempi in inglese (fonte tldr-pages)

Reapply commits from one branch on top of another branch. Commonly used to "move" an entire branch to another base, creating copies of the commits in the new location. More information

Rebase the current branch on top of another specified branch

git rebase {{new_base_branch}}

Start an interactive rebase, which allows the commits to be reordered, omitted, combined, or modified

git rebase {{[-i|--interactive]}} {{target_base_branch_or_commit_hash}}

Continue a rebase that was interrupted by a merge failure, after editing conflicting files

git rebase --continue

Continue a rebase that was paused due to merge conflicts, by skipping the conflicted commit

git rebase --skip

Abort a rebase in progress (e.g. if it is interrupted by a merge conflict)

git rebase --abort

Move part of the current branch onto a new base, providing the old base to start from

git rebase --onto {{new_base}} {{old_base}}

Reapply the last 5 commits in-place, stopping to allow them to be reordered, omitted, combined, or modified

git rebase {{[-i|--interactive]}} HEAD~5

Auto-resolve any conflicts by favoring the working branch version (`theirs` keyword has reversed meaning in this case)

git rebase {{[-X|--strategy-option]}} theirs {{branch_name}}

informazioni sul comando

nome del comandogit rebase
Utilizzo将 commits 从一个分支合并到另一个分支上。 常用于跨分支的 commits 合并,在被合并分支的最头部构建新的 `commit`,表示合并完成
Piattaforme applicabili通用
Numero di esempi8 articolo
Documentazione ufficialehttps://git-scm.com/docs/git-rebase
Fonte dei datitldr-pages(CC-BY-4.0)· Traduzione cinese comunitaria

Domande frequenti

git rebase Cosa fa il comando?

将 commits 从一个分支合并到另一个分支上。 常用于跨分支的 commits 合并,在被合并分支的最头部构建新的 `commit`,表示合并完成

git rebase Come usarlo?

Pagine elencate per scena8Esempi di uso comune: ogni esempio spiega prima lo scopo e poi fornisce un comando completo che può essere copiato direttamente (i parametri che devono essere sostituiti sono tra parentesi graffe).

git rebase Quali sono le operazioni più comunemente utilizzate?

在另一个分支的头节点合并当前分支:git rebase {{目标分支}}

Cosa significano le parentesi graffe nel comando?

parentesi graffe{{…}}Indica che è necessario sostituirlo con il proprio valore, come percorso e nome file; parentesi quadre per i parametri con lo stesso nome (come[-C|--directory]) indica la scrittura facoltativa.