Git Branching

Index

Branching is the creation of the replica of a particular branch so that parent branch remains unaffected. New branch can have new features and can be used later to merge with parent branch.

Create a new Local branch:

  1. Select the Branch which you consider as Parent branch(say ‘master’ in this case). Click on + sign in front of Branch drop down.
  2. Select Source Branch
  3. Provide the suitable name of the Local branch. say: feature1
  4. Click OK

Now, Local branch ‘feature1’ contains all the files and folders available in ‘master’. Any change performed in any file/folder of feature1 doesn’t impact master branch. This means, we have now multiple versions of the same project and it is just a matter of Branch drop-down selection and we can work on any version(branch) of the project.

Merge changes(feature1) with Parent branch(master):

Changes in feature1 can be easily merged with Parent branch(master in this case). Follow steps to port changes to master:

  1. Select feature1 branch
  2. Stage
  3. Provide Commit description
  4. Commit
  5. Select master branch
  6. Click Rebase
  7. Select local branch(feature1 in this case) and click OK

Commit on branch feature1 is a prerequisite before it can be merged with master. Merge feature1 changes with GitHub(origin/master) directly: Changes in feature1 can be ‘pushed’ to remote branch directly with following steps:

  1. Select Push
  2. Remote Branch
  3. Select master(in this case)
  4. Click OK

Note: Later in WebIDE, master branch can do a Fetch followed by Rebase with “Remote origin/master” to get the change of feature1

New remote Branch:

  1. Login to GitHub
  2. Goto repository
  3. Click Branch drop down
  4. Enter a new Branch name(say ‘GitFeature1’) and Enter(This creates a new remote Feature branch with name ‘GitFeature1’)

Now in WebIDE, we should have two remote branches available for Rebase operation. If feature1 branch was created for Proof of concept or Testing, it is a good idea to sync ‘feature1’ local branch with ‘GitFeature1’ remote branch. In this way, This new branch can be used by any other developer also without impacting master branch.

Note: WebIDE doesn’t have the capability(until the time this blog was written) to create a remote branch!

Reset a Branch(Steps):

  1. Resetting a branch causes loss of code/information as gone information can’t be retrieved back if Hard reset is selected. Mixed reset keeps committed changes.
  2. Select Branch to reset from Branch drop down
  3. Click Reset
  4. A pop-up comes. Select the Branch which should be used as a reference for Reset operation
  5. Click OK

Removing a Branch:

A Branch can be simply removed by pressing minus sign in front of Branch drop down. Just select the branch to be removed and click ‘-‘ sign!

Index

 

Advertisements

6 thoughts on “Git Branching

  1. You actually make it seem really easy together with your presentation but I in finding this topic to be actually one thing which I think I would never understand. It kind of feels too complex and very large for me. I’m having a look forward in your next submit, I’ll try to get the hold of it!

    Like

  2. You actually make it seem really easy along with your presentation however I in finding this topic to be actually one thing which I believe I might never understand. It sort of feels too complex and very broad for me. I’m looking ahead for your subsequent put up, I’ll attempt to get the grasp of it!

    Like

  3. Wow, awesome weblog format! How long have you been blogging for? you make blogging look easy. The entire look of your web site is fantastic, as neatly as the content material!

    Like

  4. It’s actually a cool and useful piece of information. I’m happy that you shared this useful information with us. Please stay us informed like this. Thanks for sharing.

    Like

  5. Helpful info. Fortunate me I found your website unintentionally, and I am stunned why this coincidence did not happened earlier! I bookmarked it.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s