简体   繁体   English

在 VSCode 上查看 git 存储库中隐藏文件夹的终端命令是什么?

[英]What is the terminal command to view hidden folders in a git repo on VSCode?

I am attempting to view my.git directory on VSCode by entering the command to show hidden files.我试图通过输入命令显示隐藏文件来查看 VSCode 上的 my.git 目录。 I understand that on a Mac, this command is: la我知道在 Mac 上,这个命令是:la

I've read that on Windows, the equivalent command is: ls -la我在 Windows 上读过,等效命令是:ls -la

However, after entering this to the VSCode terminal I am faced with the following error:但是,在将其输入到 VSCode 终端后,我遇到了以下错误:

出现的错误

What am I doing wrong?我究竟做错了什么?

@siddart: You are unfortunately incorrect on how you show hidden (dotfiles) files in the terminal/command line on macOS. @siddart:不幸的是,您在 macOS 的终端/命令行中显示隐藏(点文件)文件的方式不正确。 In order to access hidden files/folders on macOS it is actually ls and if you want to find hidden files/folders on macOS, then you use: $ ls -a为了访问 macOS 上的隐藏文件/文件夹,它实际上是ls ,如果你想在 macOS 上找到隐藏文件/文件夹,那么你可以使用: $ ls -a

Next, you are referring to PowerShell as compared to just the Command Prompt.接下来,与仅命令提示符相比,您指的是PowerShell cmd

Be aware: There is a difference in the commands and arguments in Powershell as compared to the Command Prompt.请注意:与命令提示符相比,Powershell 中的命令和 arguments 存在差异。

So with that all taken care of, the actual way to do it in Windows via Command Prompt should be exactly the same as it should be in the VS Code terminal.因此,考虑到所有这些,通过命令提示符在 Windows 中执行此操作的实际方法应该与在 VS Code 终端中的实际方法完全相同。

The folks over at Minitool show4 different ways to show hidden files from their example, I'll only show you the one from the CMD Prompt. Minitool 的人们从他们的示例中展示了4 种不同的方式来显示隐藏文件,我只会向您展示 CMD Prompt 中的一种。


How to Show Hidden Files Windows 10 with CMD如何使用 CMD 显示隐藏文件 Windows 10

You can open Command Prompt in Windows 10 to show hidden files with attrib command.您可以在 Windows 10 中打开命令提示符以使用attrib命令显示隐藏文件。

Detailed steps are as follows:详细步骤如下:

  • Step 1. Press Windows + R , type cmd , and press Ctrl + Shift + Enter to open elevated Command Prompt in your Windows 10 computer. Step 1. Press Windows + R , type cmd , and press Ctrl + Shift + Enter to open elevated Command Prompt in your Windows 10 computer.

  • Step 2. Then you can type this command line: attrib -h -r -s /s /d E:\*.* , and hit Enter to unhide the files and folders in drive E .步骤 2.然后您可以键入此命令行: attrib -h -r -s /s /d E:\*.* ,然后按 Enter取消隐藏驱动器E中的文件和文件夹。 You should replace the drive letter with the exact drive letter of your computer.您应该将驱动器号替换为您计算机的确切驱动器号。 You can open This PC to check the drive letters of your computer hard drive partitions.你可以打开这台电脑来查看你电脑硬盘分区的盘符。


C:\Windows\system32>attrib -h -r -s /s /d E:\*.*

Show hidden files cmd显示隐藏文件 cmd

To help you better understand this attrib command, below is the explanation of each part of the command line.为了帮助您更好地理解这个attrib命令,下面是命令行各部分的解释。

  • –h : It clears the Hidden file attribute to show hidden files. –h :清除隐藏文件属性以显示隐藏文件。
  • –r : It clears the Read-only file attribute to allow you modify the file after it shows. –r :它清除只读文件属性以允许您在文件显示后对其进行修改。
  • –s : It clears the System file attribute. –s :清除系统文件属性。
  • /s : It applies attrib and any command-line options to matching files in the current directory and all of its subdirectories. /s :它将attrib和任何命令行选项应用于当前目录及其所有子目录中的匹配文件。
  • /d : It applies attrib and any command-line options to directories. /d :它将attrib和任何命令行选项应用于目录。

@Siddart I hope that answers your question. @Siddart 我希望能回答你的问题。

Either use要么使用

Get_ChildItem. -Force

or use或使用

ls -Force

It'll work.它会工作的。

When in the Powershell on Windows you must use dir -force to show all files including hidden git files.在 Windows 上的 Powershell 中时,您必须使用 dir -force 显示所有文件,包括隐藏的 git 文件。 dir is the command to show your normal files and dir -force shows all. dir 是显示普通文件的命令, dir -force 显示所有文件。

Depends on the shell.取决于 shell。 If you are in cmd , you would want to use如果你在cmd ,你会想使用

dir /a

to see all files and folders including the hidden items.查看所有文件和文件夹,包括隐藏项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尽管 git 命令成功(SSH),但克隆 git repo 在 vscode 中不起作用 - Clone git repo not working in vscode although git command succeeds (SSH) 如何仅查看 VSCode 中仅包含在 git repo 中的文件? - How to view only the files those only included in git repo in VSCode? 这些隐藏('._'前缀)文件在我的git repo中是什么? - What are all these hidden ('._' prefixed) files that are in my git repo? 被忽略文件夹中的Git命令-是否可以真正忽略它在git repo中? - Git command within ignored folders - can it truly ignore that it is within a git repo? 如何使用命令行查看git repo的状态 - How to view the state of a git repo using command line 终端中的Git版本与VScode不同 - Git version in terminal not the same as VScode 什么是从远程仓库获取所有更改的git命令? - What's the git command to pull in all changes from a remote repo? Fish Shell - Init Git repo在每个命令后产生恒定的终端输出 - Fish Shell - Init Git repo yields constant terminal output after every command 尝试在 vscode powershell 终端中使用命令 git init 但出现错误:git: The term 'git' is not Recognized as the name of a cmdlet - Trying to use the command git init within vscode powershell terminal but get an error: git : The term 'git' is not recognized as the name of a cmdlet 要添加到git repo中的内容? - What to add to git repo?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM