ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Gitignore everything except src directory

asked 2017-12-09 08:54:45 -0500

sisko gravatar image

I have a catkin workspace with the following structure:

├── build
├── devel
└── src

As expected all my code/packages are in the src directory but the base directory, catkin_ws, is being tracked by GIT.

My problem is that each time I have to execute catkin_make, git status reports back modifications to build and devel directories - which I want ignored.

I created a .gitignore file under catkin_ws with the following content:

# exclude everything except directory foo/bar


But, I still get the same modified files in build and devel as shown below:

> On branch master 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)

        modified:   .gitignore
        modified:   build/CMakeCache.txt
        modified:   build/CMakeFiles/Makefile.cmake
        modified:   build/CMakeFiles/Makefile2
        modified:   build/CMakeFiles/TargetDirectories.txt
        modified:   build/CTestTestfile.cmake
        modified:   build/Makefile
        modified:   build/catkin_generated/
        modified:   build/catkin_generated/installspace/
        modified:   build/catkin_generated/order_packages.cmake
        modified:   build/catkin_generated/
        modified:   build/catkin_generated/
        modified:   build/catkin_generated/stamps/Project/
        modified:   build/catkin_make.cache
        modified:   build/cmake_install.cmake
        modified:   devel/

Untracked files:   (use "git add <file>..." to include in what will be committed)


Can anyone help, please?

edit retag flag offensive close merge delete


If you have a collection of related packages you can create a metapackage that houses those related packages and put that under version control instead.

jayess gravatar image jayess  ( 2017-12-09 11:48:29 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-12-09 09:13:31 -0500

gvdhoorn gravatar image

updated 2017-12-09 09:17:39 -0500

The proper way to approach this would be to not version your entire Catkin workspace, but just the packages / directories inside the source space.

See #q264600, #q216664 and #q257855 for some older questions and answers about this.

edit flag offensive delete link more


I think you are right.

sisko gravatar image sisko  ( 2017-12-09 09:33:16 -0500 )edit

Question Tools


Asked: 2017-12-09 08:54:45 -0500

Seen: 1,847 times

Last updated: Dec 09 '17