Show system files / Show git ignore in osx

前端 未结 10 1785
暗喜
暗喜 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 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.

提交回复
热议问题