Git Stash : Dilemma
I am experiencing strange behavior using git stash, I have two branches v0 and v1, v0 is in sink with my master branch and also with remote repo copy and v1 is the one I checkout which was similar to v0 but now I have some chan开发者_如何学Pythonges in that. So now v1 is different to v0.
Now I want to see what is there in v0 and so I do git stash on v1 branch and then checkout to v0 but it appears that whatever changes I had on v1 now it appears on v0 and so now v0 and v1 both are in sink with each other but they are not in sink with the remote repo copy.
Any guidance or suggestion of what could be possible way out for this ?
Updated :
Depending upon answer provided, I have related question like What does git stash pop do here and how does it differ from git stash apply, also do we have anything like git stash push, it appears that git stash functionalities are similar to stack datastructure
Thanks !!!
I guess you had new files on v1 that you didn't git add. git stash only affects files that are part of the repository, so it didn't stash away your new files and neither did switching branches touch them. Switch back to v1, git stash pop, git add the files, git stash again and then you are good to go.
- There is no "git stash push" but I believe you could hack the refspecs for remote repository to make stashes get pushed. I haven't seen that done before but, after all, stashes are simply stored as commits.
pop
is the same asapply
followed by adrop
if the apply is successful. If there are conflicts during the apply step, then the stash is not dropped.
精彩评论