我的git状态显示以下内容,我想创建一个新的分支并将这些未经修改的更改转移到该分支。我可以这样做吗?
<prompt>git status
# Not currently on any branch.
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: DATA/code/inc/sirApi.h
# modified: DATA/code/src/pe/include/miloSession.h
# modified: DATA/code/src/pe/milo/miloProcessSmeReqMessages.c
# modified: DATA/SME/src/sac/sacApiRoam.c
# modified: DATA/SME/src/sac/sacInsideApi.h
答案 0 :(得分:1)
试试这个:
git checkout -b newbranch
git add [your files]
git commit -m'Your message'
如果要提交所有文件,可以运行
git checkout -b newbranch
git commit -a -m'Your message'
答案 1 :(得分:0)
使用
git checkout -b <new-branch> <start-point>
其中new-branch是您要创建的分支的名称,并从sha1开始指向您希望新分支开始的位置。由于您是分离的,我认为最好明确说明起点,以便确定分支的起点。