Files
tldr/pages.zh/common/git-cherry-pick.md

21 lines
640 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# git cherry-pick
> 将现有提交引入的更改应用于当前分支。
> 要将更改应用于其他分支,请先使用 `git checkout` 切换到所需的分支。
> 更多信息:<https://git-scm.com/docs/git-cherry-pick>。
- 将提交应用于当前分支:
`git cherry-pick {{commit}}`
- 将一系列提交应用于当前分支(另见 `git rebase --onto`
`git cherry-pick {{start_commit}}~..{{end_commit}}`
- 将多个(非顺序)提交应用于当前分支:
`git cherry-pick {{commit1 commit2 ...}}`
- 将提交的更改添加到工作目录,而不创建提交:
`git cherry-pick --no-commit {{commit}}`