Ask Your Question
0

Gitignore everything except src directory

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

sisko gravatar image

I have a catkin workspace with the following structure:

catkin_ws/
├── 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

build/
devel/*

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/generate_cached_setup.py
        modified:   build/catkin_generated/installspace/_setup_util.py
        modified:   build/catkin_generated/order_packages.cmake
        modified:   build/catkin_generated/order_packages.py
        modified:   build/catkin_generated/setup_cached.sh
        modified:   build/catkin_generated/stamps/Project/_setup_util.py.stamp
        modified:   build/catkin_make.cache
        modified:   build/cmake_install.cmake
        modified:   devel/_setup_util.py

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

        src/beginner_tutorial/
        src/my-robot/
        src/oreilly/

Can anyone help, please?

edit retag flag offensive close merge delete

Comments

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 imagejayess ( 2017-12-09 11:48:29 -0600 )edit

1 Answer

Sort by » oldest newest most voted
2

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

gvdhoorn gravatar image

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

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

Comments

I think you are right.

sisko gravatar imagesisko ( 2017-12-09 09:33:16 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 332 times

Last updated: Dec 09 '17