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
- First create a new branch on your local machine. This can be done using the command `git branch
- Checkout that branch using
git checkout <branch-name>
. This will set your working tree to that branch. - Complete the work necessary to implement the feature or fix a bug.
- 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. - Perform another merge, this time first checkout master and use
git merge <branch-name>
. - You are now ready to push your changes to the remote following the procedures documented in Pushing Procedure
Eclipse
- Open Eclipse and enter the GIT view.
- Expand the project JFiles -> Branches -> Remote Tracking -> Right click master (or the branch you want to branch)
- Click "Create Branch"
- Enter the name of the new branch you want to create.
- Select "Configure upstream for push and pull"
- Click "Finish"
Now you will want to push your new branch to the remote repository
- 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.