Pages

Thursday, March 14, 2013

Git is cool and awesome!!


Using a version control system is a mandatory thing for software developments.I have personally use svn and to be very frank stumble a lot.

But when I look in git , I feel more comfortable and at home kinda feeling.Those of you are serious about it,should look in here to get your hands dirty.

First read it here

If you are impatience one like me then should start using it here
,provided you have little bit of understanding what you are doing.Just to get an feel for it and how it works.

I will update this space if I got time again with my own work...BTW you can visit my nonsense github page if you like...nothing in it...take a look..

https://github.com/unixbhaskar/

Here are few interaction with my git setup for your reference:

To see the branches:

bhaskar@Fedora_09:10:40_Sat Mar 16:~/git-linux> git branch -a
master
* testing
remotes/origin/testing


To see the my commits :


bhaskar@Fedora_09:17:57_Sat Mar 16:~/git-linux> git log -a
commit b8f0d469a3b525a524afc0905129cbb2d2248985
Author: Bhaskar Chowdhury
Date: Mon Feb 25 13:29:01 2013 +0530

adding an pattern file for ignore stuff

commit e9cf99dd57137312fe9da7d34418fbf2409856d3
Author: Bhaskar Chowdhury
Date: Mon Feb 25 12:59:04 2013 +0530

addming git source dir

commit 5e54a5e38848d547c098c829146c014ee9422720
Author: Bhaskar Chowdhury
Date: Fri Feb 22 20:15:04 2013 +0530

modified repo a bit

commit 43e5a004f3d8a56fdaa86103ae56fdc31ab5a60c
Author: Bhaskar Chowdhury
Date: Fri Feb 22 18:00:03 2013 +0530

added repo.rb

commit c7ec4663d18cb06a1179046e70b90d3cef9e8406
Author: Bhaskar Chowdhury
Date: Fri Feb 22 16:16:11 2013 +0530

suffed

commit ea7d06fe2088817b5c6a4c03f63b16956c1da950
Author: Bhaskar Chowdhury
Date: Fri Feb 22 16:15:09 2013 +0530

This is my commit

commit 3e84deef2bb7c25366fa618c0fe52c8c15de5d81
Author: Bhaskar Chowdhury
Date: Fri Feb 22 14:49:43 2013 +0530

This is comitted for testing

commit 2eedaf89ab7207b2e1b19beaedba8f2f0ec2bda7
Author: Bhaskar Chowdhury
Date: Fri Jun 29 12:30:55 2012 +0530

Setup repository


How to change branch:



bhaskar@Fedora_09:19:16_Sat Mar 16:~/git-linux> git status
# On branch testing
nothing to commit, working directory clean
bhaskar@Fedora_09:20:48_Sat Mar 16:~/git-linux> git checkout master
Switched to branch 'master'
bhaskar@Fedora_09:20:56_Sat Mar 16:~/git-linux> git status
# On branch master
nothing to commit, working directory clean


File add and commit to the testing branch:


bhaskar@Fedora_09:23:13_Sat Mar 16:~/git-linux> touch vpn_core
bhaskar@Fedora_09:23:29_Sat Mar 16:~/git-linux> git add vpn_core
bhaskar@Fedora_09:23:33_Sat Mar 16:~/git-linux> git status
# On branch testing
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
# new file: vpn_core
#
bhaskar@Fedora_09:23:54_Sat Mar 16:~/git-linux> git commit
[testing f4853f9] this is for testing purpose with vpn core
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 vpn_core
bhaskar@Fedora_09:25:39_Sat Mar 16:~/git-linux> git status
# On branch testing
nothing to commit, working directory clean
bhaskar@Fedora_09:25:47_Sat Mar 16:~/git-linux> git log
commit f4853f968ea1231cd65864972736c94c938241cd
Author: Bhaskar Chowdhury
Date: Sat Mar 16 09:25:21 2013 +0530

this is for testing purpose with vpn core


Restricting the log to specific number of commits...you might not interested in others:



bhaskar@Fedora_09:29:16_Sat Mar 16:~/git-linux> git log -p -2
commit f4853f968ea1231cd65864972736c94c938241cd
Author: Bhaskar Chowdhury
Date: Sat Mar 16 09:25:21 2013 +0530

this is for testing purpose with vpn core

diff --git a/vpn_core b/vpn_core
new file mode 100644
index 0000000..e69de29

commit b8f0d469a3b525a524afc0905129cbb2d2248985
Author: Bhaskar Chowdhury
Date: Mon Feb 25 13:29:01 2013 +0530

adding an pattern file for ignore stuff

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*~


Elaborate information about commits with stat option with log


bhaskar@Fedora_09:31:37_Sat Mar 16:~/git-linux> git log -p -2 --stat
commit f4853f968ea1231cd65864972736c94c938241cd
Author: Bhaskar Chowdhury
Date: Sat Mar 16 09:25:21 2013 +0530

this is for testing purpose with vpn core
---
vpn_core | 0
1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/vpn_core b/vpn_core
new file mode 100644
index 0000000..e69de29

commit b8f0d469a3b525a524afc0905129cbb2d2248985
Author: Bhaskar Chowdhury
Date: Mon Feb 25 13:29:01 2013 +0530

adding an pattern file for ignore stuff
---
.gitignore | 1 +
1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@


This is cool to see all at once with hash value of commit:


bhaskar@Fedora_09:32:50_Sat Mar 16:~/git-linux> git log --pretty=oneline
f4853f968ea1231cd65864972736c94c938241cd this is for testing purpose with vpn core
b8f0d469a3b525a524afc0905129cbb2d2248985 adding an pattern file for ignore stuff
e9cf99dd57137312fe9da7d34418fbf2409856d3 addming git source dir
5e54a5e38848d547c098c829146c014ee9422720 modified repo a bit
43e5a004f3d8a56fdaa86103ae56fdc31ab5a60c added repo.rb
c7ec4663d18cb06a1179046e70b90d3cef9e8406 suffed
ea7d06fe2088817b5c6a4c03f63b16956c1da950 This is my commit
3e84deef2bb7c25366fa618c0fe52c8c15de5d81 This is comitted for testing
2eedaf89ab7207b2e1b19beaedba8f2f0ec2bda7 Setup repository


With time:



bhaskar@Fedora_09:32:52_Sat Mar 16:~/git-linux> git log --pretty=format:"%h - %an, %ar : %s"
f4853f9 - Bhaskar Chowdhury, 10 minutes ago : this is for testing purpose with vpn core
b8f0d46 - Bhaskar Chowdhury, 3 weeks ago : adding an pattern file for ignore stuff
e9cf99d - Bhaskar Chowdhury, 3 weeks ago : addming git source dir
5e54a5e - Bhaskar Chowdhury, 3 weeks ago : modified repo a bit
43e5a00 - Bhaskar Chowdhury, 3 weeks ago : added repo.rb
c7ec466 - Bhaskar Chowdhury, 3 weeks ago : suffed
ea7d06f - Bhaskar Chowdhury, 3 weeks ago : This is my commit
3e84dee - Bhaskar Chowdhury, 3 weeks ago : This is comitted for testing
2eedaf8 - Bhaskar Chowdhury, 9 months ago : Setup repository



I believe this will kick you for starting!...please consult the link on top of this article to know more about git and get a hand on thing on it.

Hope this will help.

Cheers!
Bhaskar

No comments:

Post a Comment