Git development
 help / color / mirror / Atom feed
From: Ben Walton <bwalton@artsci.utoronto.ca>
To: greg.brand@nordsonasymtek.com
Cc: git <git@vger.kernel.org>
Subject: RE: Updating Files
Date: Wed, 09 Nov 2011 20:08:04 -0500	[thread overview]
Message-ID: <1320887258-sup-7544@pinkfloyd.chass.utoronto.ca> (raw)
In-Reply-To: <338A71EC3E356A47BF5279971E4EF72A04D860D7F6@WESMSG51.nordsoncorp.local>

Excerpts from Brand, Greg's message of Wed Nov 09 19:54:34 -0500 2011:

Hi Greg,

>                .<filename>.revision    ~ Does GIT have the same, or
> similar options???  I understand with the distributed nature of GIT,
> there may be several ways to accomplish this. It is nice, though, to
> be able to get a clean version without losing changes you may (or
> may not) want to keep.

You've got at least two options to store changes you want to keep but
have them kept out of the way.

1. Commit the change on a branch and leave that branch sitting there.
2. Stash the change with a descriptive note.

If you're on branch master and want to save this change but not have
it 'live' you could do:

git checkout -b save_my_change
git add modified_file
git commit -m 'saving this for later, just in case'
git checkout master

The master branch will not have the change but the save_my_change
branch will.  You can see the commit with a command like:

git show save_my_change

That looks up the sha1 for the ref that save_my_change refers to and
then shows the commit object.  To re-apply this later, you could merge
the branch to master or cherry pick the sha1 to master (or any other
branch).

The second option, stashing, is likely nicer for this type of thing
but ymmv.  In your working tree, with the modified file(s), do:

git stash save -m 'something potentially useful, but maybe not'

Your working tree is now clean and you can see stashes with:

git stash list

You can later get at a stash with git stash apply.


The real gurus may point out something nicer that I didn't think of
too...

Hope this helps.

Thanks
-Ben
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

      parent reply	other threads:[~2011-11-10  1:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10  0:54 Updating Files Brand, Greg
2011-11-10  1:05 ` Andrew Ardill
2011-11-10  1:08 ` Ben Walton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320887258-sup-7544@pinkfloyd.chass.utoronto.ca \
    --to=bwalton@artsci.utoronto.ca \
    --cc=git@vger.kernel.org \
    --cc=greg.brand@nordsonasymtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox