what does git stash do

what does git stash do

1 year ago 65
Nature

git stash is a command in Git that temporarily shelves changes youve made to your working copy so you can work on something else, and then come back and re-apply them. It takes the dirty state of your working directory, including your modified tracked files and staged changes, and saves it on a stack of unfinished changes that you can reapply at any time, even on a different branch. By default, git stash will stash changes that have been added to your index (staged changes) and changes made to files that are currently tracked by Git (unstaged changes), but it will not stash new files in your working copy that have not yet been staged or files that have been ignored. You can use git stash --include-untracked or -u to include untracked files in the stash being created. You can also use git stash push to create multiple stashes, and then use git stash list to view them. To reapply the stashed changes, you can use git stash apply or git stash pop . If you want to apply an older stash, you can specify it by naming it. It is good practice to remove stashes that are no longer needed, which can be done manually with the git stash drop command.

Read Entire Article