Temporary saving of work using git stash

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…


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


Print Share Comment Cite Upload Translate Updates
APA

Đặ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/

MLA
" » Temporary saving of work using git stash." Đặng Đình Sáng | Sciencx - Wednesday July 3, 2024, https://www.scien.cx/2024/07/03/temporary-saving-of-work-using-git-stash/
HARVARD
Đặng Đình Sáng | Sciencx Wednesday July 3, 2024 » Temporary saving of work using git stash., viewed ,<https://www.scien.cx/2024/07/03/temporary-saving-of-work-using-git-stash/>
VANCOUVER
Đặng Đình Sáng | Sciencx - » Temporary saving of work using git stash. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/03/temporary-saving-of-work-using-git-stash/
CHICAGO
" » Temporary saving of work using git stash." Đặng Đình Sáng | Sciencx - Accessed . https://www.scien.cx/2024/07/03/temporary-saving-of-work-using-git-stash/
IEEE
" » Temporary saving of work using git stash." Đặng Đình Sáng | Sciencx [Online]. Available: https://www.scien.cx/2024/07/03/temporary-saving-of-work-using-git-stash/. [Accessed: ]
rf:citation
» Temporary saving of work using git stash | Đặng Đình Sáng | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.