We help IT Professionals succeed at work.

command ls -la in git

Mike Eghtebas
Mike Eghtebas asked
on
I am following a tutorial video on git fundamentals. I am working in Windows 7 powershell (version 1.9.5.msysgit.0).

After executing >git init ,apparently it creates a .git directory which contains the repository and all its meta data.

The video displays the meta data by executing >ls -la as you can see on the image below.

I am expecting the same but I am getting the message also on the image below.

Question: How can I see the similar information as this demo video?

Also, the video display <master> at the command line area which I do not see on mine. FYI, I have started PS as admin.
git1
Comment
Watch Question

Phil PhillipsSenior Platform Engineer
Commented:
Looks like the video tutorial you are following is specifically for Linux/Unix machines.  You can use the "dir" command to do something similar in Windows.

The "<master>" part is something they've added to their prompt (again, specifically for Linux/Unix machines, but similar to this).
Mike EghtebasDatabase and Application Developer

Author

Commented:
But DIR you mention above doesn't give you meta data info it only gives you files and folder names.
Top Expert 2014
Commented:
Not sure what you're looking for.  You can't expect different utilities on different operating systems to give you exactly the same output.  You can try using the -force parameter with dir (which is an alias for Get-ChildItem in PowerShell).  The default output from dir doesn't show you all the properties, which is typical for most objects output by cmdlets.  Try running
gci | Select *
to see what I mean.

If you really want a Linux type command environment on Windows, install Cygwin.
Mike EghtebasDatabase and Application Developer

Author

Commented:
gci | Select * <-- this was very helpful.

At PSPath, : Microsoft.PowerShe...als\Readme.txt <-- this file doesn't exist yet but it has been added to git using:

>git add Readme.txt

So, I think (just guessing) after this file is physically made (or edited) will have some attributes to respond (possibly) to command like >ls -la.

PS C:\users\mike\gitcode\gitfundamentals> gci | Select *


PSPath            : Microsoft.PowerShell.Core\FileSystem::C:\users\mike\gitcode\gitfundamentals\Readme.txt
PSParentPath      : Microsoft.PowerShell.Core\FileSystem::C:\users\mike\gitcode\gitfundamentals
PSChildName       : Readme.txt
PSDrive           : C
PSProvider        : Microsoft.PowerShell.Core\FileSystem
PSIsContainer     : False
VersionInfo       : File:             C:\users\mike\gitcode\gitfundamentals\Readme.txt
                    InternalName:     
                    OriginalFilename: 
                    FileVersion:      
                    FileDescription:  
                    Product:          
                    ProductVersion:   
                    Debug:            False
                    Patched:          False
                    PreRelease:       False
                    PrivateBuild:     False
                    SpecialBuild:     False
                    Language:         
                    
BaseName          : Readme
Mode              : -a---
Name              : Readme.txt
Length            : 26
DirectoryName     : C:\users\mike\gitcode\gitfundamentals
Directory         : C:\users\mike\gitcode\gitfundamentals
IsReadOnly        : False
Exists            : True
FullName          : C:\users\mike\gitcode\gitfundamentals\Readme.txt
Extension         : .txt
CreationTime      : 2/25/2015 9:06:38 AM
CreationTimeUtc   : 2/25/2015 5:06:38 PM
LastAccessTime    : 2/25/2015 9:06:38 AM
LastAccessTimeUtc : 2/25/2015 5:06:38 PM
LastWriteTime     : 2/25/2015 9:06:38 AM
LastWriteTimeUtc  : 2/25/2015 5:06:38 PM
Attributes        : Archive

Open in new window


My bad:
After executing the following line, readme.txt had been genereted:
> echo "Hello, git">readme.txt
Top Expert 2014

Commented:
ls -la just displays a list of file and folders/directories.  -a means it includes items that start with a dot (.) like ".bashrc".  The -l is a long listing format which displays info about the item like permissions, owner, group, size, and last changed time.
Mike EghtebasDatabase and Application Developer

Author

Commented: