0

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.

Dumisani
  • 2,988
  • 1
  • 29
  • 40

1 Answers1

1

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.

Link64
  • 718
  • 4
  • 20
  • When resetting, should it be soft, mixed or hard? – Dumisani Mar 29 '18 at 12:52
  • A soft reset keeps everything in the working tree like it is, a hard reset will actually reset everything to the repository version. If I understand correctly what you are trying to achive, you need a hard reset here. [Read the documentation for more info](https://git-scm.com/docs/git-reset) – Link64 Mar 29 '18 at 12:57
  • Thank you very much – Dumisani Mar 29 '18 at 12:59
  • Instead of stashing you could also create another branch, commit your pending changes then reset to another revision. – RussKie Mar 31 '18 at 10:26