git - 使用 Git 从先前的提交分支

标签 git branch git-branch

如果我有 N 提交,我如何从 N-3 提交分支?

最佳答案

使用提交哈希创建分支:

git branch branch_name <commit-hash>

或者通过使用符号引用:

git branch branch_name HEAD~3

要在创建分支时 check out 分支,请使用:

git checkout -b branch_name <commit-hash or HEAD~3>

关于git - 使用 Git 从先前的提交分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2816715/

相关文章:

Mercurial:粒度存储库与大型存储库和版本控制中的共享第三方工具

用于将白标签实例部署到不同子域的 Git 策略。

git - git分支和标签如何存储在磁盘中?

git - "@@ -1 +1 @@"在 Git 的差异输出中意味着什么?

git - 如何在 'git-pull' 自动 merge 后更改提交消息?

typescript :如何根据类型进行分支

git - 在Git中,如何列出分支A中存在但分支B中不存在的所有文件

android - 错误 : Could not find method install() for arguments on root project of type org. gradle.api.Project

javascript - Meteor.js 项目和依赖管理

git - 卡住 Git 分支