Answer the question
In order to leave comments, you need to log in
Restoring an uncommitted branch in git
How to restore the branch, I ran into such a situation.
Made a branch:
git checkout -b feature-xxx develop
In the branch, feature-xxx made multiple changes to the code without making a git commit, switched to develop:
git checkout develop
Git wrote that it modified the changed files in develop from feature-xxx. I did not need this, so I did:
git checkout - CHANGED_FILE
I checked how the program worked before the changes in feature-xxx. Returning to feature-xxx (git checkout feature-xxx) found that the changes were gone.
Two days of work down the drain or you can return the changes?
Answer the question
In order to leave comments, you need to log in
yes, two days down the drain
in such a case, you need to use git stash
> Two days of work
AND one commit? Do them more often. Anticipating your question and thinking that you did it for later uploading to a corporate repository or (God forbid) to SVN: if you want to make one commit - after finishing work on the branch, you can merge all the changes into one commit.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question