Git Elements – Post 2

So back here again with another post on Git Elements, as promised. In the Git Elements – Post 1, I have discussed about the Git Objects. Today, i will discuss about the common operation that is performed with GIT. That is pull, push, fetch, merge, rebase, clone. First of all, I will discuss about pull, fetch, clone because three terms seems similar and then will go over push, and then merge and rebase.


You can easily infer the meaning of clone operation of git by the word. Clone operation create a new instance or copy of the remote repository into your local machine. You can correlate it with the download. Whenever you download something to your system from a server or website, you create a new copy of that file to your system.


Pull operations copies the entire changes along with git objects from the remote repository to the local machine, i.e. at your computer. To remember the function of pull you can correlate it with update. As you update anything in your system only the changes get downloaded to your system. Pull not only performs the updating process but also merges them to your main repository.


Fetch operations does action similar to pull, it copies the changes from the remote repository. But doesn’t merges them into your main branch or the branch you are currently in.



Push operation copy the entire changes along with git objects to the remote server from your local system. Correlate it with upload. But it is not quite similar to upload that you normally does. If you have ever uploaded the similar file to a remote repository you might have seen that it always create new copy to their server. Push operation only add new git objects (Read it in previous post) to the server, but data and files are not always newly created.


Git Rebase
Git Merge

In the last post, i have told you about branch object. Your repository can have many branch object but when you are done with the testing of the feature that you are doing in another branch. You want to update those changes to your main branch. This is performed by merge operation. Merging is adding changes of one branch into another generally to master branch(in pull operation).



Git Rebsing
Git Rebasing

Rebase is similar to the merge. That is it add the changes of one branch to the another branch but it does it in a different manner, what it does is it moves the branch that is to be merged(feature branch in above picture) in another branch(master branch in above picture) base and reassign the head of feature branch as the the head of master branch

That’s it for today thank you for reading the post. Another post will be published on 18th of March, 2018


Gaurav Raheja
Gaurav Raheja
Articles: 27

Leave a Reply

Your email address will not be published. Required fields are marked *