git ignore filenames which contain

Add this line to your .gitignore *_autosave* According to git help gitignore patterns match relative to the location of the .gitignore file Patternz like *_autosave* match files or directories containing “_autosave” somewhere in the name. Two consecutive asterisks (“**”) in patterns mathed against full pathname may have special meaning A leading “**” followed by a … Read more

How to tell git to ignore all further edit to a single file without removing it from the repo

Use this: git update-index –skip-worktree path/file.cfg And to restore: git update-index –no-skip-worktree path/file.cfg Lastly, if you want to list files that are marked with skip-worktree: git ls-files -v | grep ^S | awk ‘{print $2}’ To simplify, you can make an alias for that in your $HOME/.gitconfig: [alias] ls-ignored-changes = !git ls-files -v | grep … Read more

Extended regular expressions (ERE) for .gitignore

As illustrated here and detailed in “this question”, the function fnmatch() is involved to interpret glob patterns, which means regular expressions are not supported. This is what gitignore man page mentions: Otherwise, git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not … Read more

What does !*/ mean in .gitignore

Take a look at the documentation of gitignore An optional prefix “!” which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any … Read more

.gitignore – Ignore everything in a directory except one file

It seems ! only works if the file is in the same folder. A possible workaround would be to nest the same statement till you get to your final file. A bit messy, but it works. public/typings/* !public/typings/browser public/typings/browser/* !public/typings/browser/ambient public/typings/browser/ambient/* !public/typings/browser/ambient/jquery public/typings/browser/ambient/jquery/* !public/typings/browser/ambient/jquery/jquery.d.ts

Using .gitignore file to hide appsettings.json does not actually hide it

This is a common misunderstanding about the way .gitignore works we all met at some point when working with Git: .gitignore will ignore all files that are not being tracked yet; indeed, files that are already being tracked in your Git repository are not ignored by your .gitignore setup. To fulfil your need, it would … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)