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

Guide for managing a ros project with Git

asked 2017-06-23 10:19:54 -0600

ryanoldja gravatar image

I've been searching around through the documentation/forum posts and haven't really found a good walk-through explaining how to set up version control of a ros project using Git. I'll explain what I have and what I'm hoping to do (it's very possible that what I have in mind is not necessarily the most efficient way of maintaining our source code, so feel free to point me towards something more in-line with current convention or best practices). I am fairly inexperienced with ROS and Git.

Just for a very simple example, I have a catkin workspace ros_ws/ and three packages ros_ws/src/my_pkg_1, ros_ws/src/my_pkg_2 and ros_ws/src/other_pkg.

ros_ws/src/my_pkg_1 & ros_ws/src/my_pkg_2 are packages written and maintained solely be me. ros_ws/src/other_pkg is an external repository that I've cloned into my workspace.

I'd like to have version control for my_pkg_1 & my_pkg_2 within my personal repository and be able to pull and update other_pkg as it is maintained externally. Additionally, I don't want to maintain build/ or devel/ (I typically have seen these directories in the .gitignore in other examples as well). In the end, I want to be able to clone this entire project onto a new machine.

Thanks for any guidance or advice! We want to be sure we're starting off with good organization, as I'd imagine it can be painful to try to reorganize later on ...

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-06-23 11:49:22 -0600

gvdhoorn gravatar image

updated 2017-06-23 11:55:15 -0600

First: it's certainly commendable that you are researching git workflows for use with ROS. All too often repositories are a mess and that can have a real impact on the (perceived) utility of working with a VCS in the first place.


I've been searching around through the documentation/forum posts and haven't really found a good walk-through explaining how to set up version control of a ros project using Git.

there do appear to be quite some (older) Q&As on this site that deal with the same question. Some examples that may provide some insight:

  • git strategy for catkin and package folders (#q257855)
  • Best practice: one git repo per package? (#q218498)
  • What should I upload exactly to GitHub (#q173960)
  • Using git for version control with catkin and Eclipse (#q216664)

If there are still things unclear, could you edit your original question and add some specific questions?

edit flag offensive delete link more

answered 2017-06-23 10:30:07 -0600

eric1221bday gravatar image

updated 2017-06-23 10:30:29 -0600

There are a few ways of accomplishing what you want. The most common way however is to use wstool combined with rosdep. Is the documentation for wstool. But as an example, you can look at the rosinstall file of cartographer. . For reference of how to set it up. Their installation instructions here, https://google-cartographer-ros.readt... , also provide information on roughly how to use it. If each package has a package.xml setup correctly, you can even use rosdep to manage system dependencies as well.

edit flag offensive delete link more


thanks for the example ... so in this instance, is or catkin workspaces? packages? I think the installation makes sense, not sure about what is actually committed though, or how.

ryanoldja gravatar image ryanoldja  ( 2017-06-23 11:14:29 -0600 )edit

Neither are catkin workspaces, if possible you want to avoid committing entire catkin workspaces, what you can do however, is commit the rosinstall file, so that you can reconstruct your catkin workspace with just the few commands listed in the example.

eric1221bday gravatar image eric1221bday  ( 2017-06-23 12:01:41 -0600 )edit

Question Tools



Asked: 2017-06-23 10:19:54 -0600

Seen: 9,459 times

Last updated: Jun 23 '17