Smartgit: Moving local changes from stash to branch
Asked Answered
U

1

14

I have local changes which I have stored in stash. I have now (afterwards) created a new branch and want to push my changes from stash to this branch. SmartGit: Local > Apply stash.

When I try to SmartGit asks me: Restore Index (checkbox), what is this? Should I select it or not?

enter image description here

Ullyot answered 14/5, 2013 at 12:48 Comment(0)
I
15

The Restore Index option will result in a git stash apply --index. According to the git man page, this means:

If the --index option is used, then tries to reinstate not only the working tree’s changes, but also the index’s ones. However, this can fail, when you have conflicts (which are stored in the index, where you therefore can no longer apply the changes as they were originally).

So, in general, yes, you should try to apply the stash having this option enabled.

Inmesh answered 14/5, 2013 at 12:56 Comment(3)
Here is --index explained with an example, which makes things clearer: git-scm.com/book/en/v1/Git-Tools-StashingFountain
To quote the link @ThomasLauria provided: The changes to your files were reapplied, but the file you staged before wasn’t restaged. To do that, you must run the git stash apply command with a --index option to tell the command to try to reapply the staged changes.Digitoxin
And what is the "Apply & Drop" button for?Humoral

© 2022 - 2024 — McMap. All rights reserved.