{"id":17426,"date":"2020-10-19T22:15:32","date_gmt":"2020-10-20T05:15:32","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=17426"},"modified":"2023-12-01T04:03:12","modified_gmt":"2023-12-01T12:03:12","slug":"git-stash","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/git-stash\/","title":{"rendered":"Git Stash"},"content":{"rendered":"\n<p>Stashing lets you save your code for later in a <a href=\"https:\/\/careerkarma.com\/blog\/what-is-git\/\">Git repository<\/a>.<\/p>\n\n\n\n<p>When you\u2019re working with a Git repository, you may make changes to a file that you want to apply to a Git commit later on.<\/p>\n\n\n\n<p>That\u2019s where the git stash command comes in handy. Stashing lets you save the code on your working branch for a later date. In this tutorial, we\u2019ll discuss, with examples, the basics of stashing in Git and how to use the git stash command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a Git Stash?<\/h2>\n\n\n\n<p>Stashing lets you save code in your working directory and index for later. Sometimes, when you are writing code, you will want to save the changes you have made, but not <a href=\"https:\/\/careerkarma.com\/blog\/git-commit\/\">commit them to the repository<\/a>.<\/p>\n\n\n\n<p>One scenario where this may happen is in fixing issues. Suppose a bug report comes in. You&#8217;re already working on implementing a feature. You may want to save the changes you made first toward the feature and then fix the bug.<\/p>\n\n\n\n<p>This is because the bug report would likely take precedence over the feature you are developing. You would want to fix the bug first, before committing the feature-focused code to the repository. You would not want your bug fix and feature to appear in the commit. This is because larger and more complex commits make it more difficult for other developers to read the history of a repository.<\/p>\n\n\n\n<p>In other words, stashing lets you work on something else in a Git repository without having to discard or commit your existing code.<\/p>\n\n\n\n<p>Stashing allows you to save, or \u201cstash,\u201d the changes you have made to a file for later. Once a file has been stashed, you can work on something else. Then, you can come back later and apply the changes you have stashed to your code.<\/p>\n\n\n\n<p>Stashing reverts the current working directory to the last commit. This means that stashing our code gives us a clean working directory with which we can work. Having a clean directory means we can make changes without having to worry about merge conflicts. We also do not have to think about sorting the changes we make between commits.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Stash Changes in Git<\/h2>\n\n\n\n<p>The git stash command is used to stash code for later. When you run git stash, the changes you have not pushed to a commit in your current working directory will be saved for later. This includes both staged changes (changes added to the staging area using git add) and unstaged changes.<\/p>\n\n\n\n<p>Here\u2019s the syntax for the git stash command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash<\/pre><\/div>\n\n\n\n<p>Let\u2019s suppose we are working on a website and our code is stored in a Git repository.<\/p>\n\n\n\n<p>We have made changes to the index.html and index.js files in our code. We want to stash these files for later while we fix a design bug in our index.html file.<\/p>\n\n\n\n<p>To view our changes, we can use the git status command. This returns, in our example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>On branch master\nYour branch is up to date with 'origin\/master'.\n\nChanges to be committed:\n\n        new file:   index.js\n\nChanges not staged for commit:\n\n        modified:   index.html<\/pre><\/div>\n\n\n\n<p>This shows us that we have created a new file (index.js), and we have modified an existing one (index.html). We want to save these changes for later while we work on another part of our codebase. To do so, we are going to use the git stash command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Saved working directory and index state WIP on master: 3b16026 feat: Launch new homepage<\/pre><\/div>\n\n\n\n<p>The git stash command has saved the changes we made to our repository for later. Now, if we run the git status command again, we can see that there is nothing to commit:&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>On branch master\nYour branch is up to date with 'origin\/master'.\n\nnothing to commit, working tree clean<\/pre><\/div>\n\n\n\n<p>The git stash command has saved the changes we made to our repository for later. Now, if we run the git status command again, we can see that there is nothing to commit:<\/p>\n\n\n\n<p>When your code is stashed, your repository is reverted to its previous commit without the changes you made. The changes you made to your code have been saved for later. They can be applied to your codebase when you are ready by using the stash pop command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Stashing Untracked Changes<\/h2>\n\n\n\n<p>The git stash command will only stash staged and unstaged changes to files <strong>already being tracked in the Git repository<\/strong>. By default, the stash command does not include untracked changes.<\/p>\n\n\n\n<p>Staged changes are the changes that have been added to the staging area. The unstaged changes that are stashed are those made to files tracked by Git. If you change a new file that is not tracked by Git, it will not be added to a Git stash. Files that have been ignored will not be added to a stash.<\/p>\n\n\n\n<p>These are default preferences applied when using the git stash command. If you want to stash your untracked files \u2014 such as a new file that has not been staged \u2014 you can use the -u flag. Here\u2019s the syntax for the -u flag:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash -u<\/pre><\/div>\n\n\n\n<p>Alternatively, if you want to include ignored files in your stash, you can use the -a flag. Here\u2019s the syntax for the -a flag:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash -a<\/pre><\/div>\n\n\n\n<p>Using the -a flag will tell git stash to stash changes to your ignored files. These are the files defined within the <a href=\"https:\/\/careerkarma.com\/blog\/gitignore\/\">.gitignore file<\/a> in your code repository (if you have one).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Apply Stashed Changes Using git stash pop<\/h2>\n\n\n\n<p>The git stash pop command is used to apply stashed changes to a repository. Suppose we have decided that we want to apply the stashed changes we made in the previous example. We could do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash pop<\/pre><\/div>\n\n\n\n<p>The git stash pop command returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>On branch master\nYour branch is up to date with 'origin\/master'.\n\nChanges to be committed:\n\n        new file:   index.js\n\nChanges not staged for commit:\n\n        modified:   index.html\n\nDropped refs\/stash@{0} (48afd55381cf43f2332f771349c7233fb99f80a6)<\/pre><\/div>\n\n\n\n<p>Upon running the git stash pop command, the changes from our stash are applied to the local working copy of our repository. The pop command applies the code in the tash to your repository. Then, the stash is emptied.<\/p>\n\n\n\n<p>The git stash pop command also returns a list of changes you have made to your code, which shows what was in your stash.<\/p>\n\n\n\n<p>You can use the git stash apply command to apply the changes you have made to your code. You can keep those changes in your stash. We can keep the changes in our stash this using the following command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash apply<\/pre><\/div>\n\n\n\n<p>The command returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>On branch master\nYour branch is up to date with 'origin\/master'.\n\nChanges to be committed:\n\n        new file:   index.js\n\nChanges not staged for commit:\n\n        modified:   index.html<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Applying Changes Across Multiple Branches<\/h3>\n\n\n\n<p>Applying the same stashed changes to many branches across your codebase is a good use case for the stash command. For instance, you may decide to apply a stash to one branch. Then, you would move to another branch and use the same stash to apply the saved changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Multiple Stashes<\/h2>\n\n\n\n<p>You can create multiple stashes in Git. This means can make changes to one file and stash them for later. You can make changes to another file and store them in a separate stash.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Tracking Stashes<\/h3>\n\n\n\n<p>To return a list of stashes in a repository, you can run the following command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash list<\/pre><\/div>\n\n\n\n<p>Suppose we wanted to retrieve a list of all stashes we have created. We could do so by executing the above command. This command returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>stash@{0}: WIP on master: 3b16026 feat: Launch new homepage\nstash@{1}: WIP on master: 3b16026 feat: Launch new homepage<\/pre><\/div>\n\n\n\n<p>The git stash list command returned a list of our stashes.<\/p>\n\n\n\n<p>However, these stashes use only the default commit messages associated with the stash. This means that it is difficult for us to track which stash includes which changes. This is because we have not specified a description on any of our stashes.<\/p>\n\n\n\n<p>Let\u2019s say we want to add a description to a new stash. We could do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash save &quot;add new change to website&quot;<\/pre><\/div>\n\n\n\n<p>The command returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Saved working directory and index state On master: add new change to website<\/pre><\/div>\n\n\n\n<p>Rather than being given the default message associated with our last commit, our stash has been assigned its own message.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Applying Multiple Stashes<\/h3>\n\n\n\n<p>The git stash pop command applies the most recent stash to your repository (the one with the tag stash@{0}). However, when you\u2019re working with multiple stashes, you may want to apply a specific stash to your codebase.<\/p>\n\n\n\n<p>You can do so by specifying the unique ID associated with the stash you want to apply to your codebase. Suppose we want to apply the stash stored at stash@{1} to our codebase. We could do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash pop stash@{2}<\/pre><\/div>\n\n\n\n<p>The command applies the changes stored in stash@{2} to our repository and deletes the stash.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating a Branch Using a Stash<\/h2>\n\n\n\n<p>Stashing is a way to conveniently store the changes you have made to a codebase while you work on making another change.<\/p>\n\n\n\n<p>However, there may be times when, instead of maintaining a stash, you want to move your code into its own branch.<\/p>\n\n\n\n<p>This scenario could arise if there are conflicts that arise when you merge your code. You may also want to move a code into another branch if you are making larger changes to a codebase. That\u2019s where the git stash branch command comes in.<\/p>\n\n\n\n<p>You can use the git stash branch command to create a new branch to which the changes in a stash will be applied. The syntax for this command is as follows:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash branch &lt;new-branch&gt; &lt;stash-id&gt;<\/pre><\/div>\n\n\n\n<p>The \u201cnew-branch\u201d parameter refers to the ID of the branch which should be created. \u201cstash-id\u201d refers to the ID of the stash whose code you want to apply to the new branch.<\/p>\n\n\n\n<p>Suppose we want to apply the changes from our stash@{2} stash to a new branch called \u201cupdate-site\u201d. We could do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash branch update-site stash@{2}<\/pre><\/div>\n\n\n\n<p>The command returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Switched to a new branch 'update-site'\nOn branch update-site\nChanges to be committed:\n\n        new file:   index.js\n\nChanges not staged for commit:\n\n        modified:   index.html\n\nDropped stash@{2} (9a15b9cd20f8988937134d1267fafbea4c6a8647)<\/pre><\/div>\n\n\n\n<p>First, the git stash branch command creates a new branch for our stashed changes. The changes we have made to our repository are applied to the new branch. Then, we are switched to viewing that branch. Finally, our stash is deleted because the stashed code has been saved in its own branch.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Delete a Git Stash<\/h2>\n\n\n\n<p>Once you have used the code in a stash, you can use the git stash drop command to delete the stash. Here\u2019s the syntax for the git stash drop command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash drop &lt;stash&gt;<\/pre><\/div>\n\n\n\n<p>Suppose we want to drop the stash with the ID stash@{2}. We could do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash drop stash@{2}<\/pre><\/div>\n\n\n\n<p>The command returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Dropped stash@{2} (82079798c950b053fac0efb7b1d5693864dc96e7)<\/pre><\/div>\n\n\n\n<p>Alternatively, you can use the git stash clear command to delete all stashes associated with a repository. The syntax for this command is:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash clear<\/pre><\/div>\n\n\n\n<p>This command deletes all the stashes in our repository.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Stashing Specific Files<\/h2>\n\n\n\n<p>The git stash command stashes all the tracked files in your current working directory by default. However, in some cases, you may decide that you want to stash a specific file or set of files.<\/p>\n\n\n\n<p>You can stash a specific file using the git stash push command. Here\u2019s the syntax for using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash push -m &quot;&lt;message&gt;&quot; &lt;file&gt;<\/pre><\/div>\n\n\n\n<p>The \u201cmessage\u201d parameter refers to the message which will be associated with your stash. The \u201cfile\u201d parameter is the name of the file you want to stash.<\/p>\n\n\n\n<p>Suppose we want to add only the changes we have made to the index.html file in our code to a stash. We could do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash push -m &quot;feat: changed index.html file&quot; index.html<\/pre><\/div>\n\n\n\n<p>The command returns: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Saved working directory and index state On master: feat: changed index.html file<\/pre><\/div>\n\n\n\n<p>The command has only added the index.html file to a stash with the commit message \u201cfeat: changed index.html file\u201d. All other changes we have made to our code have not been added.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Show Differences Between Stashes<\/h2>\n\n\n\n<p>When you\u2019re working with stashes, you will likely make a number of different changes to your codebase across multiple commits before you return to the code that you stashed.<br><\/p>\n\n\n\n<p>For instance, if you have stashed your code and gone on to fix a bug, you may push a few commits to fix the bug before you return to your stashed code. This means that you may want to see a summary of the differences between your stash and the most recent commit of your code (so you know what changes you have made since stashing your code).<br><\/p>\n\n\n\n<p>To view the differences between a stash and your most recent commit, you can use the git stash show command. The syntax for this command is:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash show &lt;stash-id&gt;<\/pre><\/div>\n\n\n\n<p>The \u201cstash-id\u201d parameter is the ID of the stash whose changes you want to compare to the most recent commit of your branch. Suppose we want to compare the code in our stash@{1} stash to the current state of our code. We could do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash show stash@{1}<\/pre><\/div>\n\n\n\n<p>The command returns: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre> index.html | 2 +-\n index.js   | 0\n 2 files changed, 1 insertion(+), 1 deletion(-)<\/pre><\/div>\n\n\n\n<p>This output tells us that we have made two changes to our code: one insertion and one deletion. If we want to view the differences between our files, we can see them using the -p stash flag. The syntax for this flag is as follows:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git stash show -p stash@{1}<\/pre><\/div>\n\n\n\n<p>The above command, when executed, returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>diff --git a\/index.html b\/index.html\nindex 4dd1ef7..e859c68 100644\n--- a\/index.html\n+++ b\/index.html\n@@ -1 +1 @@\n-&lt;\/div&gt;\n+&lt;\/html&gt;\ndiff --git a\/index.js b\/index.js\nnew file mode 100644\nindex 0000000..e69de29<\/pre><\/div>\n\n\n\n<p>This output allows us to see a full comparison of the code in a stash and the most recent commit of a branch. The above output, for example, tells us that we removed the &lt;\/div&gt; line from our index.html file (denoted by the &#8211; symbol) and that we added the &lt;\/html&gt; line into our index.html file (denotes by the + symbol).<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The git stash command stores the changes you have made to a codebase temporarily. When you\u2019re ready, you can come back and apply the changes you have made to your codebase.<\/p>\n\n\n\n<p>This tutorial discussed the basics of stashing in Git and how you can use the git stash command to use the Git stashing feature. Now you\u2019re equipped with the knowledge you need to start stashing code like a Git pro!<\/p>\n","protected":false},"excerpt":{"rendered":"Stashing lets you save your code for later in a Git repository. When you\u2019re working with a Git repository, you may make changes to a file that you want to apply to a Git commit later on. That\u2019s where the git stash command comes in handy. Stashing lets you save the code on your working&hellip;","protected":false},"author":240,"featured_media":17427,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17286],"tags":[],"class_list":{"0":"post-17426","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-git"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Git","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Save the code on your working branch for a later date with Git Stash<\/title>\n<meta name=\"description\" content=\"The git stash command allows developers to temporarily store code for later. On Career Karma, learn how to use the git stash command.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/git-stash\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git Stash\" \/>\n<meta property=\"og:description\" content=\"The git stash command allows developers to temporarily store code for later. On Career Karma, learn how to use the git stash command.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/git-stash\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-20T05:15:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:03:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/person-typing-on-laptop-955403.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"681\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Git Stash\",\"datePublished\":\"2020-10-20T05:15:32+00:00\",\"dateModified\":\"2023-12-01T12:03:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/\"},\"wordCount\":2184,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/person-typing-on-laptop-955403.jpg\",\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/\",\"name\":\"Save the code on your working branch for a later date with Git Stash\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/person-typing-on-laptop-955403.jpg\",\"datePublished\":\"2020-10-20T05:15:32+00:00\",\"dateModified\":\"2023-12-01T12:03:12+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The git stash command allows developers to temporarily store code for later. On Career Karma, learn how to use the git stash command.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/person-typing-on-laptop-955403.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/person-typing-on-laptop-955403.jpg\",\"width\":1020,\"height\":681},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-stash\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git Stash\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/jamesgallagher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Save the code on your working branch for a later date with Git Stash","description":"The git stash command allows developers to temporarily store code for later. On Career Karma, learn how to use the git stash command.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/careerkarma.com\/blog\/git-stash\/","og_locale":"en_US","og_type":"article","og_title":"Git Stash","og_description":"The git stash command allows developers to temporarily store code for later. On Career Karma, learn how to use the git stash command.","og_url":"https:\/\/careerkarma.com\/blog\/git-stash\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-10-20T05:15:32+00:00","article_modified_time":"2023-12-01T12:03:12+00:00","og_image":[{"width":1020,"height":681,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/person-typing-on-laptop-955403.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/git-stash\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/git-stash\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Git Stash","datePublished":"2020-10-20T05:15:32+00:00","dateModified":"2023-12-01T12:03:12+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-stash\/"},"wordCount":2184,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-stash\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/person-typing-on-laptop-955403.jpg","articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/git-stash\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/git-stash\/","url":"https:\/\/careerkarma.com\/blog\/git-stash\/","name":"Save the code on your working branch for a later date with Git Stash","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-stash\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-stash\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/person-typing-on-laptop-955403.jpg","datePublished":"2020-10-20T05:15:32+00:00","dateModified":"2023-12-01T12:03:12+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The git stash command allows developers to temporarily store code for later. On Career Karma, learn how to use the git stash command.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/git-stash\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/git-stash\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/git-stash\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/person-typing-on-laptop-955403.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/person-typing-on-laptop-955403.jpg","width":1020,"height":681},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/git-stash\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Git","item":"https:\/\/careerkarma.com\/blog\/git\/"},{"@type":"ListItem","position":3,"name":"Git Stash"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/17426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=17426"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/17426\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/17427"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=17426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=17426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=17426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}