@@ -875,20 +875,38 @@ <h4>
875
875
< pre >
876
876
< b > $ git stash list</ b >
877
877
stash@{0}: WIP on master: 5857ac1 hello with a flower
878
+ </ pre >
879
+
880
+ < p > The last item added onto the stash will be referenced by
881
+ < code > stash@{0}</ code > and increment those already there by one.
882
+ </ p >
883
+
884
+ < pre >
885
+ < b > $ vim hello.rb</ b >
886
+ < b > $ git commit -am 'it stops raining'</ b >
887
+ [master ee2d2c6] it stops raining
888
+ 1 files changed, 1 insertions(+), 1 deletions(-)
889
+ < b > $ vim hello.rb</ b >
890
+ < b > $ git stash</ b >
891
+ Saved working directory and index state WIP on master: ee2d2c6 it stops raining
892
+ HEAD is now at ee2d2c6 it stops raining
893
+ < b > $ git stash list</ b >
894
+ stash@{0}: WIP on master: ee2d2c6 it stops raining
895
+ stash@{1}: WIP on master: 5857ac1 hello with a flower
878
896
</ pre >
879
897
880
898
< h4 >
881
- git stash pop
882
- < small > remove item from the list and apply to current working directory</ small >
899
+ git stash apply
900
+ < small > grab the item from the stash list and apply to current working directory</ small >
883
901
</ h4 >
884
902
885
- < p > After you've done the changes you were called away for, and you're ready to
886
- continue from where you left off, run the < code > git stash pop </ code > command
887
- to bring back the working directory to that state and remove it from the stash list .
903
+ < p > When you're ready to continue from where you left off, run the
904
+ < code > git stash apply </ code > command to bring back the saved changes
905
+ onto the working directory.
888
906
</ p >
889
907
890
908
< pre >
891
- < b > $ git stash pop </ b >
909
+ < b > $ git stash apply </ b >
892
910
# On branch master
893
911
# Changes not staged for commit:
894
912
# (use "git add <file> ..." to update what will be committed)
@@ -897,28 +915,43 @@ <h4>
897
915
# < span class ="red "> modified: hello.rb</ span >
898
916
#
899
917
no changes added to commit (use "git add" and/or "git commit -a")
900
- Dropped refs/stash@{0}: (14ddbc6f2c26330e33d08faf15d88f816b6cbd45)
901
918
</ pre >
902
919
903
920
< p > By default it will reapply the last added stash item to the working
904
921
directory. This will be the item referenced by < code > stash@{0}</ code > .
905
922
You can grab another stash item instead if you reference it in the arguments
906
- list. For example, < code > git stash pop stash@{1}</ code > will apply the item
923
+ list. For example, < code > git stash apply stash@{1}</ code > will apply the item
907
924
referenced by < code > stash@{1}</ code > .
908
925
</ p >
909
926
910
- < p > If you want to leave the item on the stack, use
911
- < code > git stash apply </ code > instead.
927
+ < p > If you also want to remove the item from the stack at the same time,
928
+ use < code > git stash pop </ code > instead.
912
929
</ p >
913
930
914
931
< h4 >
915
- git stash clear
916
- < small > remove all items from the stash list</ small >
932
+ git stash drop
933
+ < small > remove an item from the stash list</ small >
917
934
</ h4 >
918
935
919
- < p > When you're done with the stash and/or you want to remove of all the
920
- stored items, just run the < code > git stash clear</ code > command. But only
921
- do this if you're sure you're done with the stash.
936
+ < p > When you're done with the stashed item and/or want to remove it from the
937
+ list, run the < code > git stash drop</ code > command. By default this will
938
+ remove the last added stash item. You can also remove a specific item if
939
+ you include it as an argument.
940
+ </ p >
941
+
942
+ < p > In this example, our stash list has at least two items, but we want
943
+ to get rid of the item added before last, which is referenced by
944
+ < code > stash@{1}</ code > .
945
+ </ p >
946
+
947
+ < pre >
948
+ < b > $ git stash drop stash@{1}</ b >
949
+ Dropped stash@{1} (0b1478540189f30fef9804684673907c65865d8f)
950
+ </ pre >
951
+
952
+ < p > If you want to remove of all the stored items, just run
953
+ the < code > git stash clear</ code > command. But only do this if you're
954
+ sure you're done with the stash.
922
955
</ p >
923
956
924
957
< p class ="nutshell ">
0 commit comments