像个白痴一样,我所做的更改超出了当前分支的范围。
我更改了 5 个文件
M app/form_models/car_registration/basics.rb
M app/form_models/car_registration/horse.rb
M app/views/car_registration/basics.rb
M app/views/car_registration/horse.html.erb
M spec/factories/car.rb
M spec/form_models/car_registration/basic_spec.rb
我想将 basics.rb 文件提交到我的分支 basics,并将 horse.rb 文件提交到新分支 horse。我已经做了 git checkout -b horse ,并显示了所有文件。我还没有 promise 。我该怎么办?
最佳答案
您应该添加要提交的文件
git add basics.rb
然后提交
git commit -m“你的消息”
然后 stash 更改
git 存储
更改分支
git checkout -b new_branch
取消 stash 更改
git stash pop
并在新分支中提交所有更改
git commit -am“提交消息”
。
干杯
关于GIT:仅将一些更改提交到当前分支,并将其余更改提交到新分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55070859/