Git for Newbies

Git for Newbies:


Many of you especially beginners are confused about Git.
On Google there are millions of answers that explains about the concept of Git.

The technical definition about Git says that

Git is a Version Control System (VCS) for tracking source code during Software Development.

What Is A VCS?

A Version Control System in simple words can be regarded as a Source Code Management(SCM), which typically manages your different version of your information(i.e your source code).

It keeps track of your modifications done to your code and record the changes you made to it.

But there are different types of Version Control Systems

  1. Local Version Control System – It has a database system that manages the track.

  2. Centralized Version Control System – Where all the users connect to a master(central) repository.

  3. Distributed Version Control System – Where all the users can connect to multiple repositories at a time.

Important Git Terminologies

  • Repository
    In simple words, repo/repository is a type of container where we store something. Technically it is a data structure which is used by VCS where metadata of our code files and directories are stored.

  • Commit:
    Commit is a simple collection of message that explains more about the source code files and how we came to that stage. It can reminds you your intention behind changing those files, It can also help the user that uses your repo.

  • Branch:
    Think this as a simple tree branch which diverges from the main root, similarly git branch is the version of repo that divide from the main repository. In branch repo we can make various changes like:list, delete, rename etc.

  • Clone:
    Cloning in git means making a copy of the target repo and duplicating all the files of the target repo. Clone is the git command line utility.

  • Index:
    Index in git is also know as Staging area/Staging Index. A file in the Git directory that stores information about what will go into your next commit. Files on the Staging Index are poised to be added to the repository.

  • Push and Pull request:
    Git push will take all your files from the local repo and will push it to the main repo for example on Github.
    Git pull is used when you want to pull the latest changes in your main repo.

Commands For Using Git In Command Line

  1. git init – To initialize or create a repository.

  2. git add. – To add your code files to your repo.

  3. git status – To view your files in the repository.

  4. git commit -m 'your message' – To add commit messages to your code files.

  5. git push -u origin master – To push the code in your main repository or target repository.

  6. git pull 'remote_name' 'branch_name' – It will pull the contents from the main repository.

  7. git fetch – It will fetch the recent commits from the main repo to your local repository.

  8. git merge – It will merge the branch from remote to local repository.

  9. git clone repoLink – To clone the target repository.

So That’s it for Git, I hope this article will help you with your learning and will be your easy to read guide. Let me know if this article helps you.
Go on and create your first project on Github with the help of this article.

from Tumblr

Leave a Reply

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

You are commenting using your 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