![]() Stash untracked filesĪs you probably noticed before when creating stashes, stash only saves tracked files of your working directory by default.īut what if you wanted to stash untracked files of your current working directory? However, the other tracked files that may be modified in your current working directory are untouched. $ git stash push -m "message" įor example, in order to stash the “README.md” file in our current working directory but keep changes done to the other files, we would run $ git stash push -m "modified the README.md" README.md To stash a specific file, use the “git stash push” command and specify the file you want to stash. In some cases, you may want to stash a specific file in order to retrieve it later on. Using the previous commands, you have stashed all the tracked files in your current working directory. Saved working directory and index state On branch1: modified again the Stash a specific file ![]() $ git stash push -m "modified the README.md" again Now, Git did not provide a default name (made by the last HEAD commit message) but it assigned a custom name to it.Īlternatively, you can use the “ git stash push” command in order to create a stash with a name. ![]() Saved working directory and index state On branch1: modified README.md $ git stash save "my_stash_name"īack to the example we gave before on the branch named “branch1”, we would run $ git stash save "modified README.md" In order to create a git stash with a name, use the “save” command and specify the name of your stash. ![]() In this case, no names were assigned to our stash which might not be very handy if you want to pop your stash later on. Saved working directory and index state WIP on branch1: 808b598 Initial commitĪs you can see, my working directory as well as my index was saved for the “branch1” which is the current name of my branch.Īfter the colons, you can see the hash of the HEAD commit as well as the commit message : this is the name of your stash. $ git stashĪs a consequence, all the changes staged for commit in your current working directory will be saved on the side for later use. The easiest way to create a git stash is to simply run the “git stash” command without any parameters. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |