I need to switch from branch A to branch B, but I cannot because of uncommitted changes in branch A, I do not need to make these changes to the project. I want to leave everything as it was in the previous commit. Those. essentially, undo changes should be undone.
1 answer
You can put in stash .git stash push 'file_name_or_dir_goes_here' .
Thus, you do not delete your changes, but do not commit them. And you can safely switch to another branch. I understand that this is exactly what you need.
UPD
Just undo changes that are uncommitted: git reset --hard
- @ D-side Exactly, thanks, confused :) - Klimenkomud
- I do not need to save the last changes, I need to remove them (to the state it was in the previous commit) and switch to another branch. - Yiulia
- @Yiulia Completed the answer. - Klimenkomud
|