RE: Updating Files

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

 



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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]