There are lot of Git terms. In this post, we will discuss few mandatory terms which one must know while working on day-to-day basis on Git.
Git Branches -
A Branch is a mirror of your current repository. When you branch, it ensure that your main branch(Master branch) goes unaffected and is left untouched.
Git lets you branch out from the original code base. It's great way when you want to make feature of your application. Let's say you have built an application and you call it version 1.0. Once you branch it off, it gives you mirror of version 1.0 application and you'll be able to built upon that branch and keep original branch untouched.
Git Clone -
A Clone is when you download an existing remote repository to your local computer. You will then have a full-blown, local version of that Git repo and can start working on the project. It is the most common way for developers to obtain a working copy of a central repository. Cloning automatically creates a remote connection called "origin" pointing back to the original repository. This makes it very easy to interact with a central repository.
Please note, changes you make locally will not affect the files in the remote repository. After you commit your files you will have to do a Push to sync the files with the remote repository files.
Git Push -
A Git Push command is used to upload the local repository content to a remote repository. After a local repository has been modified a push is executed to share the modifications with the remote team members. It is one of the main component used in overall Git syncing process. Git push can be considered as upload command.
Git Pull -
A Git Pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Git pull can be thought of as download command. The git pull command is actually a combination of 2 commands, git fetch followed by git merge. The git pull command first runs git fetch which downloads content from the specified remote repository. Then a git merge is executed to merge the remote content refs and heads into a new local merge commit.
Git Merge -
Merge command is used to integrate the branches together. It combines the changes from one branch to the main(master) branch.
Git Fetch -
Pull without merge. The git fetch command downloads commits, files and refs from a remote repository into your local repo. If you want to see what other developers have been working on, you do a fetch. Git isolates fetched content from existing local content, it has no effect on your local development work. Fetched content has to be checked out explicitly using git checkout command. This makes fetching a safe way to review commits before integrating them with your local repository.
When downloading content from remote repository, you have 2 commands - git pull and git fetch. You can consider git fetch the 'safe' version of the two commands. It will download the remote content but not update your local repo's working state, leaving your current work intact. git pull is the more aggressive alternative; it will download the remote content for the active local branch and immediately execute git merge to create a merge commit for the new remote content. If you have pending changes in progress this will cause conflicts and kick-off the merge conflict resolution flow.
Git Checkout -
A "checkout" is the act of switching between different versions of a target entity. The git checkout command operates upon three distinct entities: files, commits, and branches. The git checkout command lets you navigate between the branches created by git branch. Checking out a branch updates the files in the working directory to match the version stored in that branch, and it tells Git to record all new commits on that branch.
With this, I'll wrap up this post here.
In the next post, we will discuss on how to configure Repository.
Thank you for reading !
*** Explore | Share | Grow ***
Comments