I had a lot of trouble with git ignore, because most of the time I only want to include certain files, instead of ignoring some files.
Say I only want to add all the .m file and ignore the rest in my Matlab workspace. It is actually fairly simple from this post. I need to ignore all the files by putting * at the beginning, and then unignore all sub directories by !*/, then tell git that I want all the .m files by !*.m, as simple as that!
The gitignore file looks like this
*
!*.cpp
!*.h
!*.m
!*/
Also, according to this, if I am in a catkin workspace, but has a subdir for matlab code, I need to create another git ignore file in matlab folder like this
*
!*.m
!*/
so that only m file will be included.
If I want to only include the cpp, h, and txt file in the src folder, then in the catkin workspace, use gitignore like this
*
!*/
!/src/*.cpp
!/src/*.h
!/src/*.txt
No comments:
Post a Comment