Search code examples
gitgithubgit-svn

Never commit my changes in my submodule


I have added a sub module in my project. And it is been used by many different projects. In that sub module I need a special constructor in a particular class. I updated the particular class. But when ever i try to push code of my own project it asks me to commit those changes [Which i don't want too], so i select skip option.

Is there any way to avoid this alert.I don't want to commit it anytime.

Thanks.


Solution

  • Like I commented on the question, this is an odd thing to want. It would mean that the changes you make to your root repository are only useful for yourself, not for others, because others won't get the submodule changes they need.

    That said, if you have a good reason for this, my approach would be to go to the subdirectory and make sure those modifications no longer show up. For existing files, this means using git update-index --assume-unchanged. For new files, this may mean adding them to .gitignore. That, in turn, may need to marked as unchanged or added to itself. The only problem is with deleted files: do not delete them. Instead, make sure they end up unused. That may involve changing those files, or other files.

    Note that this assumes that you have not yet made a commit in your submodule. If you have, you'd need to undo that first.