如何从旧提交创建新的 Git 分支?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7167645/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 11:40:45  来源:igfitidea点击:

How do I create a new Git branch from an old commit?

gitbranchcommit

提问by JZ.

Possible Duplicate / a more recent/less clear question
Branch from a previous commit using Git

可能重复/最近/不太清楚的问题
使用 Git 从先前提交中分支

I have a Git branch called jzbranchand have an old commit id: a9c146a09505837ec03b.

我有一个Git分支叫jzbranch和有一个旧的提交ID: a9c146a09505837ec03b

How do I create a new branch, justin, from the information listed above?

如何justin根据上面列出的信息创建一个新分支?

回答by bdonlan

git checkout -b justin a9c146a09505837ec03b

This will create a new branch called 'justin' and check it out.

这将创建一个名为“justin”的新分支并检查它。

git branch justin a9c146a09505837ec03b

This just creates the branch without checking it out.

这只是创建分支而不检查它。