Branching - rsanchez-wsu/jfiles GitHub Wiki

Branches

When to Branch?

  • To implement a new feature.
  • To fix a bug

For example, if you are wanting to add a search functionality to the client GUI then you would create a new branch called client-search. You would do all the work implementing this feature on this branch, and when the feature is complete you merge this branch back into master.

Command Line

  1. First create a new branch on your local machine. This can be done using the command `git branch
  2. Checkout that branch using git checkout <branch-name>. This will set your working tree to that branch.
  3. Complete the work necessary to implement the feature or fix a bug.
  4. Merge the master branch into your branch using git merge master, resolving any conflicts that may arise. This allows us to resolve conflicts on our side giving us a conflict free merge of our branch into master.
  5. Perform another merge, this time first checkout master and use git merge <branch-name>.
  6. You are now ready to push your changes to the remote following the procedures documented in Pushing Procedure

Eclipse

  1. Open Eclipse and enter the GIT view.

  1. Expand the project JFiles -> Branches -> Remote Tracking -> Right click master (or the branch you want to branch)
  2. Click "Create Branch"

  1. Enter the name of the new branch you want to create.
  2. Select "Configure upstream for push and pull"

  1. Click "Finish"

Now you will want to push your new branch to the remote repository

  1. Right click the project root and select "Push to Upstream" NOTE: This will push all changes you have in your workspace so you may either want to just push your new branch or wait until you are at a stable state to push.

Note: You may need to login using your GIT credentials for the first push you make.