git ignore local changes

Written by
Typical Read
1 minutes
Find your next web developer job
UI Developer (Contractor) at Phyton Advisors (Houston, TX)

You may not want to always commit local files and directories to your git repo and adding them to the .gitignore isn't the solution if you don't want those ignored files to be shared. Learn how to git ignore local changes.

How to Git Ignore Local Changes

If you don’t want to create a .gitignore file to share with others, you can create rules that are not committed with the repository to git ignore local changes. You can use this technique for locally-generated files that you don’t expect other users to generate, such as files created by your editor.

Use your favorite text editor to open the file called .git/info/exclude within the root of your Git repository. Any rule you add here will not be checked in, and will only ignore files for your local repository.

Git ignore Local Changes, Files, and Directories

  1. Open Terminal.

  2. Navigate to the location of your Git repository.

  3. Using your favorite text editor, open the file .git/info/exclude.

Did you find git ignore local changes useful? Get articles in your inbox.

…and don’t worry, I hate spam as much as you. Expect to hear from me at most once a week.

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on facebook

Stay updated.

Get a weekly email with the latest trends in web development & SEO.

Write a guest post.

Have an interesting article or idea? Become a guest blogger & pitch me your concept today.

Join the conversation.

Your email address will not be published. Required fields are marked *

All comments posted on 'git ignore local changes' are held for moderation and only published when on topic and not rude. Get a gold star if you actually read & follow these rules.

You may write comments in Markdown. This is the best way to post any code, inline like `<div>this</div>` or multiline blocks within triple backtick fences (```) with double new lines before and after.

Want to tell me something privately, like pointing out a typo or stuff like that? Contact Me.