"GIT" What, how , ..etc ?

GIT ?

Git is distributed version control system focused on speed, effectivity and real-world
usability on large projects
.”

The above snip can be found here at “http://git-scm.com/about”…

I dont know how many people are using “git” with their daily work.. But I know almost all open source projects are moving to “git” model Or almost done..

The most expensive usage of “git” will be kernel source tree maintenance .. :)..

There are lots of tutorials on “git” .. How-ever nothing stopping me to put something about “git” here in my space..:)

The git commands man page can be explore in this “git-” format.

ex: man git-init

[humble@humble ~]$ mkdir git_text
[humble@humble ~]$ cd git_text

==> So I created an experimental directory for git ..

[humble@humble git_text]$ git init
Initialized empty Git repository in /home/humble/git_text/.git/
[humble@humble git_text]$

==> Hope it is self explanatory

[humble@humble git_text]$ touch file.c
[humble@humble git_text]$ cat file.c
# include

int main ()
{
printf (“\nI am part of git\n “);
}

[humble@humble git_text]$ git commit
[master (root-commit) fb67d46] I am adding my first file to git repository
1 files changed, 6 insertions(+), 0 deletions(-)
create mode 100644 file.c

==> So above is “commit” opration for git like any other revision control system. but note that it is a commit here in local repository.

[humble@humble git_text]$ git log
commit fb67d4632a3e6fbee80622b57505cfef889fd5a5
Author: Humble Chirammal <humble@XXXX.com>
Date: Sun Feb 28 16:06:28 2010 +0530

I am adding my first file to git repository

==> So the sentence starting from “I am adding..” is the commit message.

You can see a commit id ( fb67d4632a3e6fbee80622b57505cfef889fd5a5 for your reference.

From where this “Name” and “email” comes ?

hmmm .. I have a .gitconfig file in my home directory for it..

[humble@humble git_text]$ cat ~/.gitconfig
[user]

name = Humble Chirammal
email = hchiramm@XXXX.com
[hchiramm@hchiramm git_text]$

[humble@humble git_text]$ git branch f_op

==> Now I created a new branch called “f_op” created .

[humble@humble git_text]$ git branch -a
f_op
* master

===> This lists all the available branches in my git directory and it shows now u r in “master” branch with the “*”..

[humble@humble git_text]$ git checkout f_op
Switched to branch ‘f_op’

==> I switched to my new branch..

[humble@humble git_text]$ git branch -a
* f_op
master

==> Notice “*” there in above

[humble@humble git_text]$cat ./branch_file.py
#!/usr/bin/python

if __name__ == “__main__”:
print “I am main”

==> So I have a file in this branch

[humble@humble git_text]$ git checkout f_op
A branch_file.py
Already on ‘f_op’
[humble@humble git_text]$ git add branch_file.py
[humble@humble git_text]$ git commit
[f_op eb3a38d] this is a python script for something
1 files changed, 4 insertions(+), 0 deletions(-)
create mode 100755 branch_file.py

===> commit done ..

[humble@humble git_text]$ git log
commit eb3a38d7f0c0c7f4631d2a06971cf42e77485254
Author: Humble Chirammal <humble@redhat.com>
Date: Sun Feb 28 16:19:17 2010 +0530

this is a python script for something

commit fb67d4632a3e6fbee80622b57505cfef889fd5a5
Author: Humble Chirammal <humble@redhat.com>
Date: Sun Feb 28 16:06:28 2010 +0530

I am adding my first file to git repository

Above shows logs about my commits.. in reverse order ..

It goes like this .. so I am putting a “Full stop” on git commands ..

If you want to clone a particular project ( upstream) in your local system and start fixing the bugs , first clone it

#git clone git.fedorahosted.org/git/

From there you can experiment in the same tree and can be updated the files in any branch or inside the project .

Once you are satisfied with your bug fixing , you can do a push to upstream..

Another important commands on git .. #git push..#git pull

If you are interested to know more on git have a look at below references..

References:
git.wiki.kernel.org/index.php/GitDocumentation
git-scm.com
excess.org/article/2008/07/ogre-git-tutorial/

Leave a Reply

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