Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

> mkdir drafts && echo '' > ./drafts/.gitignore

thanks for the tip, is there a way to hide files at root level? I want to hide some .env. files



sort by: page size:

If I have local "dirty" state that I need to hold on to, I just hide it in a temp directory like this:

  mkdir temp
  echo '*' >temp/.gitignore
Quick, dirty, effective. :)

There’s a solution to this problem: https://github.com/sindresorhus/hide-files-on-github

Additionally, your OS probably already natively hides files that start with a dot, so this is just a UI problem.

Please don’t “solve” this issue by moving files to a sub-directory. If anything, only leave non-config files there, it’s the obvious simple solution that most projects follow anyway.


This has been proposed yearly for a long time. See https://dot-config.github.io/ for one of the latest attempts.

Hiding files under a directory is not really a solution for anything other than slightly improving file navigation, but even if you think it's valuable, the real problem is getting tools to adopt it. There is no incentive to be the first. The intermediate state is terrible - now you need to guess if a config is located at the root or this new config directory, and if your version of the tooling is able to pick up the new location.


This works really well to hide stuff from the public repo. The only downside is I don't think it's possible to then use source control on the ignored files in that folder. But if that's not a requirement it's probably the best way to go.

Great tip! Didn't know about this.

A similar one: ~/.config/git/ignore is a global private gitignore.

Great for files across repos which you always want to ignore, such as temporary files from an editor


Something like:

git config --global core.excludesfile ~/.gitignore-global echo .DS_Store >> ~/.gitignore-global


I use a .gitignore in root directory and ignore everything but the files that I control - theme and custom plugins.

There are often times when I want certain files ignored in gitignore, but I still need to work with them and/or search them in the editor.

For me, it's nice to have a separate way to tell Sublime what to hide.


I have my homedir in git too and also ignore just about everything. I ended up using gitignore as a whitelist instead of a blacklist, e.g.:

    /*
    !/.gitignore
    !/.gitmodules
    !/.gitconfig
    !/.zshrc
    !/.zshenv
    !/.zsh
    !/.tmux.conf
    !/.vimrc
    !/.vim

Put them into your global .gitignore

    echo -e >>~/.config/git/config '[core]\n    excludesFile = ~/.config/git/gitignore'
    echo >>~/.config/git/gitignore '.env'

Now you have hidden subfolders with .git in your source.

And remember git doesn't save directories that are empty.


Yeah I've been using that for quite some time and it's incredibly useful.

You can also set a global ignore file, which you could set in one of your path based includes.

  [core]
    excludesfile = ~/.gitignoreglobal
https://github.com/sammcj/zsh-bootstrap/blob/master/.gitconf...

While I always hate the cluttering of "top" directories, id think something more like `.gitignore.local` at the top level would be much better than where its hidden

I don't even want to see the .DS_Store files at all :) (I am aware of the checkbox to hide gitignored files, but still like to see everything)

It would probably make sense to default to using .gitignore if a .kiteignore hasn't been specified; likely the same things that you'd want hidden.

? Would it not be secure enough to put .git in the directory above the public root:

  /mysite/.git
  /mysite/mysiteroot/index.html
  /mysite/.gitignore
  /mysite/lib/common

I would recommend using torus.sh or other secret manager instead of an env or text file. I've forgotten to include them in .gitignore too many times.

That's cool!

You can also put local gitignore rules in .git/info/exclude , but i have a hard time remembering that exact path for some reason.


To people like me who have done this many times in the past and want to add the file to gitignore

http://stackoverflow.com/questions/1139762/ignore-files-that...

The other alternative I can think of is to hide sensitive values in environment variables

next

Legal | privacy