[kwlug-disc] Advanced(?) Git usage question

John Johnson jvj at golden.net
Wed Apr 16 11:33:23 EDT 2014

This is definitely, not an an "advanced" question.
But it is one for which I could not an answer on the Google or in Git tuts.

Using Git, can one, without creating a branch, pull a file from an 
earlier commit?
And (asking a lot) store the pulled file in a place other than the 
current working directory?

Unless I need to do some more reading, git commands, revert pull and 
checkout all seem to operate on the repo as a whole and not on 
individual files.

Tips / comments / guidelines / advice / etc. from those who have gone 
before me are welcome.


On 2014-04-15 21:44, Chris Frey wrote:
> On Tue, Apr 15, 2014 at 08:47:41PM -0400, John Johnson wrote:
>> A tip on Git that I read somewhere was to develop a consistent style
>> in the git commit messages, e.g. git -am [message text], so as to
>> make subsequent searches easier. For example, if one was using an
>> issue tracking system with issues SCR 1024 SCR 2031 SCR 112 being
>> active and the commit was to combine repairs that addressed these
>> issues, the commit message could be: git commit -am "issues: SCR
>> 1024 SCR 2031 SCR 112" or similar.
> That "git commit -am" worries me. :-)  My usual process is:
> 	git add -p
> 	git commit	# with editor
> This allows more detailed commit messages than just a single line.
> And the git-add with '-p' makes sure you only commit the changes you
> intend.  You can also break your current workspace into multiple
> commits, making them small and logical.
> Also, in git, the first line is special, as you probably know.
> But there exists a --grep option in commands such as git-log, for
> searching commit messages.  For example, if your commit message said:
> 	driver: fixed off-by-one error in buffer init
> 	Changed code to use sizeof() instead of hard coded value.
> 	Fixes SCR 1024, SCR 2031, SCR 112
> Now, if you do:
> 	git shortlog
> you get a nice brief description of your changes, yet you still have
> your bug tracking IDs in the commits, so that this is possible:
> 	git log --grep="SCR 2031"
> - Chris
> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
> -----
> Checked by AVG - www.avg.com
> Version: 2014.0.4355 / Virus Database: 3882/7345 - Release Date: 04/14/14

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20140416/09059c26/attachment.html>

More information about the kwlug-disc mailing list