在我的代码发生一些变化后,我注意到我需要在新分支中推送此更改,所以我这样做:
$ git checkout develop
error: Your local changes to the following files would be overwritten by checkout
Please commit your changes or stash them before you switch branches.
Aborting
$ git commit -m "Update code to follow pep8 style"
[hotfix/tests 4aadaf0] Update code to follow pep8 style
54 files changed, 455 insertions(+), 331 deletions(-)
$ git checkout develop
Switched to branch 'develop'
Your branch is up-to-date with 'origin/develop'.
$ git checkout -b feature/pep8-code-style
Switched to a new branch 'feature/pep8-code-style'
$ git push origin feature/pep8-code-style
Total 0 (delta 0), reused 0 (delta 0)
我丢失了我的代码。它在哪里?
答案 0 :(得分:3)
您的更改和提交仍应保留在hotfix/tests
分支上。什么都没有丢失:
[hotfix/tests 4aadaf0] Update code to follow pep8 style
因此,提交4aadaf0
包含您的pep8样式更改。