Reputation: 967
I cloned a repo, then made some changes on the local copy, I wanted to upload to a new branch. so I run the following commands:
git add .
git checkout -b new-branch
git add .
git stash
git push origin new-branch
All of the sudden ,my changes are gone , the repo has the same structure as I cloned it.
How to retrieve my changes??
Upvotes: 2
Views: 45
Reputation: 9905
It sounds like you stashed your changes, which puts them in a temporary stack data structure. You can get them back by using git stash apply
, which applies the top of the stack back to your files.
See git help stash
for more info. In particular, checkout git stash list
and git stash show
for commands to see what's in the stash stack.
TBH, something like SourceTree can also be nice for quickly glancing through the stash to see what's there.
Upvotes: 1