1

I have 2 issues:

  1. I want git to ignore symlinks
  2. I have noticed late that it is committing symlinks. HOw can i remove these committed symlinks. They have already been pushed to a remote.
Marty Wallace
  • 34,046
  • 53
  • 137
  • 200

2 Answers2

15

add all symbolic links in .gitignore

find . -type l >> .gitignore

remove all symbolic links from repository

find . -type l -exec git rm --cached {} \;
Alec
  • 1,178
  • 5
  • 20
1

1) Don't git add any symlinks then. That includes things like git add -A and what-not that automatically add things that aren't currently being tracked.

2) git rm <symlink>; repeat for each symlink, then git commit. Of course you'll need to do this on every branch. Also, if you want to remove all symlinks throughout your project's history, you'll need to do the same on every commit, which can be done with git filter-branch.

twalberg
  • 59,951
  • 11
  • 89
  • 84