user7804233
user7804233

Reputation:

Have I lost a commit?

After some changes in my code I've noticed that I need to push this changes in a new branch, so I do:

$ 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)

Here I've lost my code. Where is it?

Upvotes: 0

Views: 34

Answers (1)

knittl
knittl

Reputation: 265908

Your changes and your commit should still be on your hotfix/tests branch. Nothing has been lost:

[hotfix/tests 4aadaf0] Update code to follow pep8 style

So commit 4aadaf0 contains your pep8 style changes.

Upvotes: 3

Related Questions