emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: git is screwed


From: John Wiegley
Subject: Re: git is screwed
Date: Thu, 26 Mar 2015 10:10:27 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (darwin)

>>>>> Richard Stallman <address@hidden> writes:

> Looking at man git-stash

>        save [-p|--patch] [--[no-]keep-index] [-u|--include-untracked]
>        [-a|--all] [-q|--quiet] [<message>]
>            Save your local modifications to a new stash, and run git reset
>            --hard to revert them. The <message> part is optional and gives the
>            description along with the stashed state. For quickly making a
>            snapshot, you can omit both "save" and <message>, but giving only
>            <message> does not trigger this action to prevent a misspelled
>            subcommand from making an unwanted stash.

> That sounds dangerous so I didn't do it yet.  Is that what I should do?

Before you do a complex operation (such as a pull when you have both locally
committed changes, and locally uncommitted changes), you can run "git stash"
to safely squirrel away your work.  It sounds dangerous from the man page, but
it's a very safe operation.  I do it regularly.

Then, proceed with your complex operation.  Once you get everything back to a
sane and reasonable state, you can "git stash pop" to move your local changes
from the stash back to the working tree.  If these changes conflict, you will
be left with conflicted files that need manual resolution, but that is all.
Think of the stash as a highly temporary branch (which is what it really is,
behind the scenes) to which your work has been saved for the time being.

Some people have even created a "git-smart-pull" utility that automatically
does a stash save/pop when necessary before a pull, in order to be consistent
in their workflow.  I don't have a link handy, but others might also use it
and can comment.

John



reply via email to

[Prev in Thread] Current Thread [Next in Thread]