Git clone 指定分支
git clone -b branch_name repository_url
// 假设你想要克隆一个名为 example-repo 的仓库的 feature-x 分支,你可以这样做
git clone -b feature-x https://github.com/username/example-repo.git
Git 基于某个 commit 创建分支
git switch -c <新分支名> <目标提交的哈希值>
// 例如,如果你想基于提交abc123创建一个名为feature-branch的新分支,你可以这样做:
git switch -c feature-branch abc123
正文完