This content originally appeared on DEV Community and was authored by Đặng Đình Sáng
Introduction
git stash
to temporarily save changes you are working on.
How to use it
Save changes temporarily
git stash
This saves the changes in your current working directory to a stash, leaving your working directory clean.
Apply the stash
git stash apply
This applies the latest stash to the current working directory. The stash remains in place and can be reapplied.
Apply and remove the stash
git stash pop
This will apply the latest stash and remove it from the stash at the same time.
Display a list of stashes
git stash list
This will display a list of saved stashes.
Apply a specific stash
git stash apply stash@{1}
If multiple stashes exist, you can apply a specific stash by using the format stash@{n}.
Drop a specific stash
git stash drop stash@{1}
To drop a specific stash, use the following command.
This will remove the stash at stash@{1}.
Conclusion
A git stash is useful for temporarily storing changes you are working on so you can do other work or switch branches.
This content originally appeared on DEV Community and was authored by Đặng Đình Sáng
Đặng Đình Sáng | Sciencx (2024-07-03T13:34:12+00:00) Temporary saving of work using git stash. Retrieved from https://www.scien.cx/2024/07/03/temporary-saving-of-work-using-git-stash/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.