Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 使用现有更改创建新分支_Git - Fatal编程技术网

Git 使用现有更改创建新分支

Git 使用现有更改创建新分支,git,Git,我克隆了存储库的一个主分支,并做了一些更改。如何使用这些更改创建分支?我不想把它们推给master。以备将来参考。通常情况下,在进行任何更改之前,您会进行分支。但供将来参考 git stash save git stash branch <branchname> git隐藏保存 吉特储藏处 如果您尚未提交: $ git checkout -b <new_branch_name> # create (and checkout) the new branch $ git

我克隆了存储库的一个主分支,并做了一些更改。如何使用这些更改创建分支?我不想把它们推给master。

以备将来参考。通常情况下,在进行任何更改之前,您会进行分支。但供将来参考

git stash save
git stash branch <branchname>
git隐藏保存
吉特储藏处

如果您尚未提交:

$ git checkout -b <new_branch_name>   # create (and checkout) the new branch
$ git commit -a                       # commit to the new branch
$ git branch <new_branch_name>     # create the new branch
$ git reset --hard HEAD^           # rewind master

$ git checkout <new_branch_name>   # switch to the new branch