diff options
Diffstat (limited to 'doc/university/training/topics/stash.md')
-rw-r--r-- | doc/university/training/topics/stash.md | 82 |
1 files changed, 4 insertions, 78 deletions
diff --git a/doc/university/training/topics/stash.md b/doc/university/training/topics/stash.md index 051103e5f4b..ea9ba6a7bcc 100644 --- a/doc/university/training/topics/stash.md +++ b/doc/university/training/topics/stash.md @@ -1,82 +1,8 @@ --- -stage: none -group: unassigned -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments -comments: false +redirect_to: '../../../topics/git/stash.md' --- -# Git Stash +This document was moved to [another location](../../../topics/git/stash.md). -We use `git stash` to store our changes when they are not ready to be committed -and we need to change to a different branch. - -- Stash: - - ```shell - git stash save - # or - git stash - # or with a message - git stash save "this is a message to display on the list" - ``` - -- Apply stash to keep working on it: - - ```shell - git stash apply - # or apply a specific one from out stack - git stash apply stash@{3} - ``` - -- Every time we save a stash it gets stacked so by using `list` we can see all our - stashes. - - ```shell - git stash list - # or for more information (log methods) - git stash list --stat - ``` - -- To clean our stack we need to manually remove them: - - ```shell - # drop top stash - git stash drop - # or - git stash drop <name> - # to clear all history we can use - git stash clear - ``` - -- Apply and drop on one command: - - ```shell - git stash pop - ``` - -- If we meet conflicts we need to either reset or commit our changes. -- Conflicts through `pop` doesn't drop a stash afterwards. - -## Git Stash sample workflow - -1. Modify a file -1. Stage file -1. Stash it -1. View our stash list -1. Confirm no pending changes through status -1. Apply with pop -1. View list to confirm changes - -```shell -# Modify edit_this_file.rb file -git add . - -git stash save "Saving changes from edit this file" - -git stash list -git status - -git stash pop -git stash list -git status -``` +<!-- This redirect file can be deleted after <2021-08-13>. --> +<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> |