# Revision history [back]

With catkin, the last sourced setup.(z/ba)sh wins. Thus, there is no assignment of priorities or something similar, other than way how you build your workspace.

As explained in detail in #q64702, you can "extend" one workspace with another. But this is a rather unusual usage, from my experience.

More typical is to use "workspace chaining", which is specifying the order of the search path for ROS packages. The answer you linked does explain this behavior, and this is the link to the respective tutorial.

Using catkin_tools this is also doable, though you can/need to be more explicit! The chaining (you also chain the /opt/ros and your source ws, let's call it ~/catkin_ws when working with only one ws) happens implicitely when you have sourced /opt/ros/DISTRO/setup.zsh and call catkin init for the first time. This is what you see in the output of catkin config under the "Extending" listing in catkin_ws.

To change which ws you are extending, simply call catkin config --extend /path/to/new/ws in the workspace that you want to overlay/extend over the others. I.e. if you want to overlay ~/overlay_ws over ~/catkin_ws, call

cd ~/overlay_ws
catkin config --extend ~/catkin_ws/devel
catkin clean # there is no way around deleting your build/devel folders when changing chaining
catkin b


Note that deleting devel and build is required for this to work, but only when changing the chaining.