GitHub collaboration cheat sheet - Ridgebeck/CarND-Capstone-Team-Herbie GitHub Wiki

We will work on different files (ROS nodes) in parallel. Those nodes depend on each other and therefore it is very important to keep the master branch clean. Please follow the following rules to allow a good collaboration in this project.

  • When working on any feature or update, please make sure you are always working in a separate branch and not the master.
  • The master branch is protected and a direct push to it is not possible. All changes have to be merged into the master branch as described in the following example:
  1. For the first time only: Clone the repository via git clone repo_URL. You know how that works. :)
  2. Create a new branch with a name that describes the feature. For example git branch feature creates a new branch named "feature" and checkout the branch via git checkout feature. It is good practice to always verify which branch you currently have checked out via git branch, which gives you a list of all branches and shows which one is selected. I would recommend to do this every time before you commit changes.
  3. Add and commit your changes as usual.
  4. You should push your commits (in the branch) frequently to the repo even if not everything is 100% finished. This helps the team to see where we are and if we can help out. In this example you would use the command git push origin feature to push the changes to the remote.
  5. Before you merge your branch with the master on the remote, check that your local master is still up to date. If anything has changed pull the new master from GitHub to your branch. That way you can make sure your feature works with the newest version of master. Select your branch via git checkout feature and then pull via git pull origin master. Update your code if necessary and commit the changes.
  6. Once you think everything is ready to be merged into the master branch you can push your final version to GitHub and create a pull request. You can do this directly on GitHub. Select your branch and click the button "New Pull Request". Make sure that our repository and not the one from Udacity is selected. Once that is done, everybody can check the code and comment on it if necessary. The pull request can then be approved and the feature will be merged into the master branch.
  7. Everyone should update their local master or feature branch after a feature has been merged to make sure you are working with the latest running version. When you are currently working on a feature, make sure you are in the feature branch and merge the master into your feature branch via git pull origin master. If you are not working on a feature, (e.g. because you are the one that made the pull request) check out your local master via git checkout master and pull the master from the remote via git pull origin master. After that you can create a new branch from the new master version for the next feature.

Repeat the steps for any new feature you want to implement.

Herbie