How to ignore changes in git submodules

When I was dealing with complex project with some submodules, submodules always get dirty after I configure them independently. This is very common but cause whole git dirty and ugly. Is there a simple way to solve something like this:

On branch master
Your branch is ahead of 'origin/master' by 1 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)

modified: converter/cl2ptx/libclc (untracked content)

The solution is quite simple. After you add your submodules. .gitmodules must be in your repository directory. Edit it and add one more line “ignore = dirty”. The file would be like this:

[submodule "converter/cl2ptx/libclc"]
path = converter/cl2ptx/libclc
url =
ignore = dirty

Problem Solved!!! Enjoy your neat and clean git repository!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s