Show system files / Show git ignore in osx

前端 未结 10 1725
暗喜
暗喜 2020-12-22 18:46

By default it is not possible to see .gitignore files in osx. What is command to reveal these files?

相关标签:
10条回答
  • 2020-12-22 18:56

    ⌘⇧. will toggle the AppleShowAllFiles setting.

    This key combo will work from open/save dialogue boxes in all apps, not just the finder. Use this and you’ll never be confused when on someone else’s Mac or a new Mac, and you can avoid mucking around with defaults write.

    I use the nemonic of “use a dot to show a dot file” to remember it, because of hidden dot files in unix.

    0 讨论(0)
  • 2020-12-22 19:01

    Open the terminal and type

    • on OS X 10.8:

      defaults write com.apple.Finder AppleShowAllFiles TRUE
      
    • on OS X 10.9:

      defaults write com.apple.finder AppleShowAllFiles TRUE
      

    Then you must relaunch finder:

    killall Finder
    

    Any file name in OS X prefixed with a '.' is considered "hidden".

    0 讨论(0)
  • 2020-12-22 19:03

    In addition to the accepted answer, you can create an alias to easily show/hide the hidden files in Terminal. This is how I set it up (tested/working on macOS Mojave 10.14.1).

    In my user directory I created a new file .custom_aliases and wrote this in:

    # Show/hide files
    alias showall='defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder'
    alias hideall='defaults write com.apple.finder AppleShowAllFiles -boolean false; killall Finder'
    

    Next I opened .bash-profile (should also be in your user directory, if not just create it there) and added this to the top of the file:

    # Load custom aliases
    source ~/.custom_aliases
    

    And that's it! Now whenever I need to view the hidden files I just type showall in Terminal and hideall when I'm done. You could also define the aliases directly in the .bash_profile, but I have some other stuff so I like to keep all the aliases together in a separate file.

    0 讨论(0)
  • 2020-12-22 19:06

    You can use the shortcut in Finder:

    Command + Shift + .

    It will show the hidden files. To hide the files again, use the same shortcut.

    0 讨论(0)
  • 2020-12-22 19:09

    It's possible you might just not have a .gitignore file. If you don't have one, you can create it like this:

    >touch ~/.gitignore
    

    And then edit it however you'd like. Git will automatically check this file, without any additional configuration!

    0 讨论(0)
  • 2020-12-22 19:10

    (more recent, for 10.10.2:)

    The above commands didn't work for me. I'm using OSX Yosemite: 10.10.2. This worked though:

    defaults write com.apple.finder AppleShowAllFiles -boolean true;
    killall Finder;
    

    Source: http://www.idownloadblog.com/2014/08/04/how-to-show-hidden-files-folders-finder-mac/

    0 讨论(0)
提交回复
热议问题