In my git repository I have two branches master and legacy. I have added the following .gitmodules file to my legacy branch. master branch does not have a .gitmodules file.However the git submodule is getting checked out in master branch. In the legacy branch nothing is getting checked out. 
My .gitmodules file .
[submodule "build"]
    path = build
    url = git@git.gitlabs.com:Karthik.Sharma/build.git
    branch = 0.4
What am I doing wrong?
 
    