![]() ![]() Git checkout -b temp # optional: create a new branch for "apply" Or maybe it goes more like this: git status # see if there's anything you need to commit Git checkout -b temp # create new temp branch to save stuff # uh oh, there is - let's put it on a new temp branch That way the "somewhere" that you are applying them, has nothing else in it, and you'll just be trying the stashed changes: git status # see if there's anything you need to commit This one is beyond the scope of this answer see this other StackOverflow answer instead.įor complicated cases, I recommend starting in a "clean" working tree first, by committing any changes you have now (on a new branch if you like). You're using git stash save -keep-index in order to test "what will be committed". So now you use git stash apply -index, and that sometimes fails with: Conflicts in index. You had one version in the stashed index/staging area and another (different) version in the working tree. (Extra-advanced) You've used git stash save -p, or carefully git add-ed and/or git rm-ed specific bits of your code before running git stash save. I personally prefer to transfer these changes to a new branch, because branches have names, and cleanup-attempt-in-December means a lot more to me than (The git stash command takes an optional save-message, and those can help, but somehow, all my stashes just wind up named WIP on branch.) Again, the one without a number is also you pile up a lot of stashes, it can get fairly messy (was the stash I wanted or was it Wait, I just pushed another, now they're 8 and 5?). Dropping a specific stash renumbers only the higher-numbered ones. You can apply and then drop a specific stash, too: git stash apply and so on. If you had, even more, the one that was becomes and so on. When you git stash drop, it drops the newest, and the one that was moves to the top of the stack. The newest is always the lowest-numbered. If you do that, you have two stashes, one just called stash-but you can also write one spelled Use git stash list (at any time) to see them all. You can in fact git stash save again, as git stash makes a "stack" of changes. Now you want to keep, or even move, these changes, and apply your stash too. Then you switched to another branch and started more changes, forgetting that you had the stashed ones.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |