Reputation: 157
I am new to Git and not sure what I did wrong. I have bunch of branches along side master for example - filling-layout, data-upload, sign-in-out etc. I had moved on to a new branch, when I had to change something in my layout. So I thought it would be better to go back to filling-layout branch and make the changes there. So I typed in git checkout filling-layout
and that erased a bunch of things that I had in the layout and its back to a previous version and all my changes disappeared. I thought I had committed filling-layout after all my changes and uploaded it to github and heroku.
Upvotes: 1
Views: 627
Reputation: 44387
Try checking out the previous branch.
This might work
git checkout -
It will try to checkout the branch you were on before the current one (analogous to cd -
).
Once you have committed your changes in git it is very difficult to loose them. Checking out a branch will change the working tree to match what is in that branch, but switching back will restore the state of the working tree to that of the previous branch.
Another way to find previous commits is by using git reflog
. That will list what commits HEAD has been at, and using the hash you can checkout any of those.
Upvotes: 4