What is git?
So, what is Git in a nutshell? This is an important section to absorb, because if you understand what Git is and the fundamentals of how it works, then using Git effectively will probably be much easier for you. As you learn Git, try to clear your mind of the things you may know about other VCSs ( Version Control), such as CVS, Subversion or Perforce — doing so will help you avoid subtle confusion when using the tool. Even though Git’s user interface is fairly similar to these other VCSs, Git stores and thinks about information in a very different way, and understanding these differences will help you avoid becoming confused while using it.
Git can be defined as a distributed version control system for tracking changes in source code during software development.
In simple terms Git is like a person who observe your code and remembers what you and your teammate changed, when you changed it and why you changed it.
What is a Repository?
The purpose of Git is to manage a project, or a set of files, as they change over time. Git stores this information in a data structure called a repository.
A git repository contains, among other things, the following:
- A set of commit objects.
- A set of references to commit objects, called heads.
In simple terms Repos are the folders which are used by that person to store the the changes for different projects.
What is a branch?
A branch can be understood as a lightweight movable pointer that helps the developer to differentiate between the actual project and changes performed by him/her.
In simple terms understand it as, that person keeps the track of projects in parallel timelines. Now the original project is the Master. If someone wish to do some changes to that project as an experiment without changing the main project, then he/she needs to make a branch coming out of the Master so that its easy to perform experimentation with the project without loosing the integrity of the project.
What is Remote Repo?
A repo that is hosted/ stored on a code hosting service like GitHub or on an internal server.
Like GitHub is called remote repository because its hosted on a remote server! GitHub is notthe only option there are other choices like GitLab and BitBucket.
Don’t lag behind in today’s tech-savvy world! Follow us on
or subscribe to our newsletter
Basics of GIT CLI
1) GIT CONFIG
Utility: To set your username and email in the main configuration file.
How to: ” git config –global user.email “[email protected]”&&git config –global user.name”demoname” “
2) GIT INIT
Utility: To initialize a git repository for a new or existing project.
How to: goto root directory of your project then ” git init “
3) GIT CLONE
Utility: To copy a repository from remote source, it also sets the remote to original source so that you can pull again.
How to: “ git clone < git URL to clone > “
4) GIT STATUS
Utility: To check the status of the files you have changed in your working directory, like what all has changed since your last commit.
How to: “git status“
5) GIT ADD
Utility: To add changes to your working directory so that git can index those files.
How to: ” git add <to add all changed file to git >” or “ git add <filename>“
6) GIT COMMIT
Utility: To commit/save changes you have made to your local repository and sets it to a new commit object for your remote repository.
How to: “ git commit -m“you can also put some messages here” “
7) GIT PULL/PUSH
Utility: Push or Pull your changes to remote. If you have added and committed your changes and you want to push them. Or if your remote has updated and you wanted those latest changes.
How to: ” git pull <remote><branch>” and ” git push <remote><branch> “
These were the very basics of the GIT version control system.
These might also interest you…
A technology enthusiast who loves to create and break things. Love to work on Linux, technology, and Computers. I am a CyberSecurity aficionado, and wannabe wildlife Photographer constantly learning and experiencing new things.