0

I have two repos. They both include the same git subtree.

During development, I want to symlink one subtree dir to the other.

/app1
  - subtree
/app2
  - subtree -> /app1/subtree

When I run git status on app2 I get see that app2/subtree and its contents have been deleted.

I want git to ignore the deleted files for the /app2 repo.

And I want to be able to make commits to app2 (not touching anything in subtree).

I tried adding subtree/ to .git/info/exclude but the deleted files still show in git status.

I tried git update-index --assume-unchanged subtree/ too and it also didn't work.

vaughan
  • 6,982
  • 6
  • 47
  • 63

1 Answers1

0

After reading this answer I worked out my problems were caused by:

  • Not running update-index before deleting the files.
  • Not using a wildcard for the files to ignore with update-index.

Running this before deleting the files works:

git update-index --assume-unchanged subtree/**/*(.)

NOTE: The (.) was necessary because without it I got fatal: Unable to mark file subtree/some-dir. And using **/*.* would leave out files like Vagrantfile.

Use git ls-files -v | grep '^h' to verify which files are assume-unchanged.

You can add them as git aliases here.

vaughan
  • 6,982
  • 6
  • 47
  • 63