Project

General

Profile

Working on a feature branch (to easily share code)

(Adapted from the 35 ton tutorials by Karl Warburton)

  1. Setup your directory.
  2. Change to desired repository (e.g sbndcode).
    cd $MRB_SOURCE/sbndcode 
  3. Make sure you have the latest develop branch.
    git checkout develop
    git pull 
  4. Make a new feature branch.
    git flow feature start < BranchName > 
  5. Do some coding.
  6. Check which files you have created/edited.
    git status #Lists the changed/edited modules#
    git diff #Line by line description of what has been changed# 
  7. Push to your feature branch if it's not ready for publishing (store it for later).
    git add file_name.cc #Do this for all the files you want to add#
    git commit -m "about the commit" 
  8. Publish the feature branch.
    git flow feature publish < BranchName > 
  9. When the project is finished you can now either delete the feature branch or merge it into develop.
    • Delete feature branch locally.
      git branch -d feature/< BranchName > 
    • Delete feature branch in origin.
      git branch -dr origin/feature/< BranchName > 
    • Merge into develop.
      git flow feature finish < BranchName > 

      Note that this merges the feature branch into your local develop branch, deletes the local feature branch, but it does not push the changes into the remote develop branch, nor it deletes the remote feature branch.
      If merged you might want to push to develop.
      git push origin develop