Re: [git-users] Looking for a change to a file

2015-09-13 Thread Charles Manning
When you're trying to find why a specific change was made, then git blame
is also your friend.

On Mon, Sep 14, 2015 at 7:16 AM, Paul Smith  wrote:

> On Sun, 2015-09-13 at 11:32 -0700, Michael wrote:
> > I've got a file, with a diff/change, that I thought had already been
> > checked into a previous commit. I want to see if this change exists in
> > any checkin of that file.
> >
> > Is there any way to ask for "all the checked-in versions of file X"?
> > As far as I know, git only knows files by their sha hashes, and not by
> > names -- which already tells me that there's probably something that I
> > really don't understand about git.
>
> Git doesn't know files by SHA hashes.  Git knows "a set of changes to
> one or more files" by its SHA hash.  The SHA hash names the _commit_ not
> a specific file.
>
> However, if you want to see the commits that impacted a given file it's
> trivial:
>
>   git log 
>
> If you want to see the commits that impacted any file in a subdirectory
> that's trivial as well:
>
>   git log 
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Looking for a change to a file

2015-09-13 Thread Paul Smith
On Sun, 2015-09-13 at 11:32 -0700, Michael wrote:
> I've got a file, with a diff/change, that I thought had already been
> checked into a previous commit. I want to see if this change exists in
> any checkin of that file.
> 
> Is there any way to ask for "all the checked-in versions of file X"?
> As far as I know, git only knows files by their sha hashes, and not by
> names -- which already tells me that there's probably something that I
> really don't understand about git.

Git doesn't know files by SHA hashes.  Git knows "a set of changes to
one or more files" by its SHA hash.  The SHA hash names the _commit_ not
a specific file.

However, if you want to see the commits that impacted a given file it's
trivial:

  git log 

If you want to see the commits that impacted any file in a subdirectory
that's trivial as well:

  git log 


-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Looking for a change to a file

2015-09-13 Thread Michael
I've got a file, with a diff/change, that I thought had already been checked 
into a previous commit. I want to see if this change exists in any checkin of 
that file.

Is there any way to ask for "all the checked-in versions of file X"? As far as 
I know, git only knows files by their sha hashes, and not by names -- which 
already tells me that there's probably something that I really don't understand 
about git.

---
Entertaining minecraft videos
http://YouTube.com/keybounce

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Looking for a change to a file

2015-09-13 Thread Magnus Therning
On Sun, Sep 13, 2015 at 03:16:21PM -0400, Paul Smith wrote:
> On Sun, 2015-09-13 at 11:32 -0700, Michael wrote:
> > I've got a file, with a diff/change, that I thought had already been
> > checked into a previous commit. I want to see if this change exists in
> > any checkin of that file.
> > 
> > Is there any way to ask for "all the checked-in versions of file X"?
> > As far as I know, git only knows files by their sha hashes, and not by
> > names -- which already tells me that there's probably something that I
> > really don't understand about git.
> 
> Git doesn't know files by SHA hashes.  Git knows "a set of changes to
> one or more files" by its SHA hash.  The SHA hash names the _commit_ not
> a specific file.
> 
> However, if you want to see the commits that impacted a given file it's
> trivial:
> 
>   git log 
> 
> If you want to see the commits that impacted any file in a subdirectory
> that's trivial as well:
> 
>   git log 

For easy viewing of both log and the actual diffs I can recommend the
tool `tig`:

tig 

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4 
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

Unreadable code,
Why would anyone use it?
Learn a better way.
 -- Geoff Kuenning's contribution to the 2004 Perl Haiku Contest,
Haikus about Perl - 'Dishonerable Mention' winner

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.