Skip to content

Instantly share code, notes, and snippets.

@zaenk
Created July 18, 2019 15:02
Show Gist options
  • Save zaenk/ee7ddacb748124a32150d0a730ef49bf to your computer and use it in GitHub Desktop.
Save zaenk/ee7ddacb748124a32150d0a730ef49bf to your computer and use it in GitHub Desktop.
git ignore changes in local repo

Context: working on a fork of a libraray that generates lots aof code for testing and also uses a subrepo. I only want to commit my changes. Also I would like to use VS Code's git support for that. I also do not want to modify the .gitignore file.

Steps to ignore these changes locally:

Add the directories to local exlude:

vi .git/info/exclude
# IDE files
.vscode/
# Directory with lots of generated code - will commit this before I submit a PR
browsers-test/
# git submodule - the builds also modifies files under this directory
libsodium

To ignore changes already made bu the build process, run:

git update-index --assume-unchanged libsodium
git update-index --assume-unchanged browsers-test/*

I also added these directories to exlude list of VS Code.

Sources:

https://stackoverflow.com/a/28620604

https://stackoverflow.com/a/51989573

https://stackoverflow.com/a/51989573

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment