Before going straight into the tutorial for GIT first it is
important to know what is GIT it’s uses and applications and after that we will
straight go to the tutorial of commands in GIT and before that you should know
that learning both GIT and it’s commands are very easy.
GIT was first created in the year 2005 by Linus Torvalds. It
is a distributed version control system which is used during software development to track the changes in the course of development. The changes can
be tracked in any set of files and it is designed with the purpose to coordinate
work amongst the programmers. GIT stores
all the information of projects and files in structure called GIT Repository
which is the core of GIT. The major goals of GIT are to maintain great speed and data integrity
and also it works to support the distributed and non linear work flows.
The operations in GIT
Here I have mentioned the operation major operations in GIT which
are divided into two sects - the basic operations and the advanced operations.
The basic operations in GIT are:
1 ) Initialize
2 ) Add
3 ) Commit
4 ) Push and
5 ) Pull.
The advanced operations are:
1 ) Branching
2 ) Merging and
3 ) Rebasing
The first thing you need to do is to install the GIT system.
Now, let us proceed with the basis operations:
Initialize: To initialize first you need to perform
the operation or you need to use the command ‘ git init .’ This command creates
space that is either by emptying an existing Git Repository or by creating a
new one. What happens is that this command creates a .git directory along with
the file templates and the sub directories if the repository is newly created
and if it creates directory in an already existing repository then in that case
it does not overwrite the previously written templates but adds new ones.
Add: The main function of this operation is to make
changes in the working tree, that is it prepares the content in the staging
area for it’s next commit. The add command is used to add new or modified files
to the index and it should be used before running the commit command.
You can use it as the following : git add < directory
> or git add < files >
Commit: This command means recording snapshots of a
given repository at a given time. One feature of this command is that it cannot
change on its own unless it’s is changed intentionally . Moreover, it does not
copy whatever instructions you enter in the directory because git aims at
keeping commit as light as possible in it’s weight. To brief it : the commit
command only copies the changes made in the repository.
Pull: The work of this command is to identify the
changes occurred in the remote repository and shift it to the local repository.
It also works to combine the upstream changes in the local repositories and
this is a common task in the git collaborations. You can use the command as
following :
git pull origin < Branch name >
Push: The work of this command is just the opposite
to that of the pull command that is it transfers the changes from the local
repositories to the central repositories. Once you are done collecting a lot of
local commits and you are ready to share them then you can use the push command
to move them to central repository. You can use the command as following
:
git push < remote >
In the same way you can use the advanced operations like
git branch < Branch name >
git merge < Branch name >
Conclusion:
Now from this article you know how to use git and
also you have learnt the basic operations one usually needs to know if he or
she installs git. You can also take the help of Techasoft a leading
software development company in Bangalore which is every ready to assist it’s clients.