Search code examples
gitgit-rebasegit-extensionsgit-reset

Reset git branch to a specific commit and keep stashed changes (Using Git Extensions)


enter image description here

As stated on the title. I was wondering what happens when I select the Reset current branch to here. I've stashed all the changes I made and want to:

  1. Revert the branch to a specific commit,
  2. Merge changes from another branch, then
  3. Use Stash pop to bring back my changes and commit.

Will my stashed changes be lost? Is Rebase current branch the best option instead?

enter image description here

When resetting, should I select Soft, Mixed or Hard?

Thank you.

Solution - I selected Reset branch to here and chose Hard Reset. Obviously sorted out a few merge conflicts and used Stash pop and committed.


Solution

  • No, your stash is kept separately and will not be lost.

    If you want to play it safe, you can use git stash apply which will not remove it after applying, unlike git stash pop. This way you are able to apply it to a different commit again later.