Archive

Archive for March, 2024

Using the git stash command

March 29, 2024 Leave a comment

Notes:

$ git stash # to create/save changes
$ git stash save <description> # to specify the name of the stash
$ git stash list # to view a list of the current stashes that exist
$ git stash pop <stash_id> # apply the saved changes and remove changes
                           # from stash
$ git stash apply <stash_id> # apply the saved changes but keep changes on
                             # the stash
$ git stash clear # empty the stash list by removing all the stashes
$ git stash drop <stash_id> # deletes a particular stash from the stash list
$ git stash show <stash_id> # view the diff of a stash
$ git stash branch <new_branch_name> <stash_id> # create a new branch
                              # based on the commit the stash was created
                              # from and pop the stashed changes to it

Source:
https://opensource.com/article/21/4/git-stash

Categories: git Tags: