user1443098
user1443098

Reputation: 7685

git show command yields no results

Trying to understand this:

PS C:\Users\BRITTG2\source\repos\tbsm.canoe.core (feature/bau-1057)
> git ls-files | sls Filtered

Projects/TBSM.Canoe.Core/TBSM.Canoe.Core.Common/TBSM.Canoe.Core.Common.Domain/Certificates/FilteredCertificates.cs

Why does git show not display the blob and also not give an error?

PS C:\Users\BRITTG2\source\repos\tbsm.canoe.core (feature/bau-1057)
> git show Projects/TBSM.Canoe.Core/TBSM.Canoe.Core.Common/TBSM.Canoe.Core.Common.Domain/Certificates/FilteredCertificates.cs

PS C:\Users\BRITTG2\source\repos\tbsm.canoe.core (feature/bau-1057)
>

for comparison

    > cat Projects/TBSM.Canoe.Core/TBSM.Canoe.Core.Common/TBSM.Canoe.Core.Common.Domain/Certificates/FilteredCertificates.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
etc.

Update:

the first answer below works:

git show HEAD:yourfile

Is there a way to specify wildcards in the show command so that I can show the file without a full (and possibly long) path?

Upvotes: 1

Views: 44

Answers (1)

that other guy
that other guy

Reputation: 123690

git show yourfile is equivalent to git show HEAD -- yourfile and will try to find the changes to the file in the current commit. If the file was not modified in that commit, nothing will be shown.

To instead show the content of a file as it was at a given revision:

git show HEAD:yourfile

Upvotes: 5

Related Questions