Git Code-Rebase – Master Software Solutions

What is Git-Rebase?

Git Rebase is a mechanism to handle two separate branch code very easily. Its somewhere similar to Git Merge. Many of the programmers get confused between merge and Rebase. Git merge is basically to push your all local changes into Master branch and merge your changes their and then again you need to pull latest code from master branch. In layman language you can say Upload code to server(Master Branch).
Rebase Will let your commit on top. Any user can Rebase his branch with any of other branches and Reapply changes their.

Steps to Rebase:-

  • Commit your code on your local or working Tree branch

(if you are not aware about git commit then please go to last section of this blog)

Commit is process to save all local changes on your working Tree. Because Git will never allow you to perform any action before commit code. If you want to pull code, Push, Switch/checkout anything , you need to commit code first otherwise it will give you Error.

  • Git switch/checkout

It will help you to move into another Branch.

Go to Master Branch or switch to master branch.

  • Select master branch

Choose master from dropdown list and click OK. After Clicking OK you will switch to master branch successfully.

  • Git Pull

It will bring you the latest changes.Git Pull is a mechanism to Pull or get the latest code from your remote branch to your local branch.

  • Git Switch/checkout

Again back to your own branch(As ravi-ui is local branch here)

  • Click on Rebase
  • Left side is your working tree (branch) and right side is branch which you want to rebase branch.

Here we have master branch in R.H.S.

8) Now rebase your code with master branch just click on Start Rebase.

Code is Rebased completely and now you are ready with latest changes.

Git Commit:
Git Commit is saving your changes on your local machine. you can not perform any action without committing your code. Commit will save your code on your machine and you can go back to your any previous committed code. So as programmer please make habit of regular commit code because main advantage is it will save your time to let you know what you have done in past. which user made changes at what line. So you can easily blame but only if your code is committed.

Git Pull:

Git Pull is process of getting latest code from your remote server branch. Sometime when you will go for git Pull code it throw an error that “Git Did not Exit Cleanly” then only commit code.

Git Push:

Git Push is a process to upload your changes back to your remote server. once it is push to server , anyone can access your code by pulling branch. So you can even access your own code any other machine just by connecting with your remote server.

Git blame:

some time you stuck in problem that why some developer has made these changes. what could be the logic behind this. Git blame provide you all those facility to know who has done these changes and Git blame will tell you exactly developer name, Change date.