Skip to content

immortalcodes/git-ignore-local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

git-ignore-local

Ignore files locally in Git when you can’t use .gitignore.

git-ignore-local is a lightweight command-line tool that integrates with Git to help you ignore files using .git/info/exclude. This is useful when you want to ignore files locally but don’t want to (or can't) commit changes to .gitignore, such as machine-specific configs, debug logs, or IDE files.


Installation

  1. Download the prebuilt binary for your OS and architecture from the Releases page,
    or build it yourself by running:

    ./build.sh
  2. Install it as a Git subcommand:

    sudo cp build/git-ignore-local-<your-platform> /usr/local/bin/git-ignore-local
    chmod +x /usr/local/bin/git-ignore-local

    You can now use it via:

    git ignore-local

Usage

Add files or patterns

git ignore-local <pattern1> <pattern2> ...

Example:

git ignore-local .env logs/debug.log config/dev.yaml

This appends the given patterns to .git/info/exclude.

Restore (remove) files or patterns

git ignore-local --restore <pattern1> <pattern2> ...

Example:

git ignore-local --restore logs/debug.log

This removes matching lines from .git/info/exclude.


Notes

  • All paths or patterns must be specified relative to the root of the Git repository.

    For example, if your Git project is located at:

    /home/user/my-project/
    

    And you want to ignore this file:

    /home/user/my-project/logs/debug.log
    

    You should run:

    git ignore-local logs/debug.log

    Do not use absolute paths or paths relative to your shell location. Always start from the Git root.


Reporting Issues

If you find a bug or unexpected behavior, please open an issue in the repository. Contributions and feedback are welcome.

About

Git tool to ignore files that you can't add in .gitignore

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published