Mastering Git - Part 3: Stashes | Ray Wenderlich

Git stashes offer a great way for you to create a temporary snapshot of what you're working on, without having to create a full-blown commit. Discover when that might be useful, and how to go about it.

This is a companion discussion topic for the original entry at

Hi Sam, the command

git stash push -m “message”

does not work for me, I am on the latest version of MacOS and my GIT version is 2.11.0 (Apple Git-81)

Also I am not very familiar with VIM how do you managed to add the contributor at the end of the file, my cursor can’t go pass the last line



Hi @giguerea

What happens when you use that git stash command? Do you see an error, or does it just not work?

vim is a little confusing at first. It has the notion of different modes—two of which are command and insert modes. When you first open vim, you’re in command mode, which allows you to navigate around, and run different commands. However you can’t add new text without entering insert mode.

You can switch to insert mode by pressing lowercase i. vim will then behave like a traditional editor, until you press esc, which takes you out of insert mode, and back into command mode, at which point you can save and quit using :wq.

There are other ways to get into insert mode, that do things like “add a new line below”, or “replace the rest of this line”. You can find many good tutorials on vim across the web to learn more.

Hope that helps


yeah, git stash works but if I do git stash --help, there is not git stash push option

I know the basic of VIM but was wondering how you did, no problem I’ll find a good tutorial on that :slight_smile:


Hi @giguerea

I didn’t realise that git stash push wasn’t in every recent version of git. git stash save -m "Message" should replicate the behaviour pretty closely (not sure whether they both have the same behaviour when clearing the working directory).

As for vim—whilst in vim, to add a new line a the end of the file and switch to insert mode type capital G and then lowercase o.


1 Like

Re: git stash push -m

I’m able to do it like what Sam did in the tutorial, but I had to update git version to the latest.
My git version now is 2.14.1 from 2.11.0 (Apple Git-81).


1 Like