Alexandre Fernandes Bartolomeu Alexandre Fernandes Bartolomeu - 10 months ago 54
Git Question

How to checkout submodule in Makefile in subdirectory

Right now that is what I have :


git checkout master -C $(DATA_DIR)
git pull -C $(DATA_DIR)

Submodule is located in DATA_DIR.

The problem with what I have is when I do "make data", I get the following error : "error : unkown switch 'C'". I assume it is because git assumes -C is a command for itself rather than a command for the Makefile, because after it lists me all the commands I can use in git.

My question is this : How can I checkout the submodule located in DATA_DIR.

Thank you for taking the time of reading my question.

Answer Source

Try instead

git -C $(DATA_DIR) pull

-C applies to the git command itself, not as an option of pull.

-C <path>

Run as if git was started in <path> instead of the current working directory.