About -- Git :distributed version control
Git
In software development, Git /ɡɪt/ is a distributed version control and source code management (SCM) system with an emphasis on speed.[3] Initially designed and developed by Linus Torvalds for Linux kernel development, Git has since been adopted by many other projects.Every Git working directory is a full-fledged repository with complete history and full version tracking capabilities, not dependent on network access or a central server.
Git is free software distributed under the terms of the GNU General Public License version 2.
Ref. : https://en.wikipedia.org/wiki/Git_%28software%29
I have few tried to create few test to rewind the skills-set for basic "git" knowledge:-
Git: Install :
Ubuntu :sudo apt-get install git
RHEL/CentOS/Fedora:
yum install git
Git :User Configuration :
# your namegit config --global user.name "Example Name"
# your email-address
git config --global user.email "email@gmail.com"
# enables color highlighting for Git in the console
git config --global color.ui true
git config --global color.status auto
git config --global color.branch auto
#Automate username/password entry when git pushing over http from windows machine
git config credential.helper cache
git config credential.helper 'cache timeout=360000'
# Git will use the KDiff3 tool for diff viewing and merge
git config --global merge.tool kdiff3
Git:Verify the configuration using :
administrator@srv-ubuntu:~$ cat .gitconfig [user]
name = CASAS
email = raCCCC08@CCCl.com
[color]
ui = true
status = auto
branch = auto
[credential]
helper = cache
[merge]
tool = kdiff3
administrator@srv-ubuntu:~$ git config --list
user.name=CASAS
user.email=raCCCC08@CCCl.com
color.ui=true
color.status=auto
color.branch=auto
credential.helper=cache
merge.tool=kdiff3
administrator@srv-ubuntu:~$ git config --global --list
user.name=CASAS
user.email=raCCCC08@CCCl.com
color.ui=true
color.status=auto
color.branch=auto
credential.helper=cache
merge.tool=kdiff3
administrator@srv-ubuntu:~$
Git:Working & Testing:
administrator@srv-ubuntu:~$ mkdir ~/Local_repo01
administrator@srv-ubuntu:~$ cd Local_repo01
administrator@srv-ubuntu:~/Local_repo01$ pwd
/home/administrator/Local_repo01
administrator@srv-ubuntu:~/Local_repo01$ mkdir datafiles
administrator@srv-ubuntu:~/Local_repo01$ git init //Initialize "Git" repository & create.git folder
Initialized empty Git repository in /home/administrator/Local_repo01/.git/
Git:Directory Structure:
administrator@srv-ubuntu:~/Local_repo01$ tree -La 2.
|-- datafiles
`-- .git
|-- branches
|-- config
|-- description
|-- HEAD
|-- hooks
|-- info
|-- objects
`-- refs
7 directories, 3 files
administrator@srv-ubuntu:~/Local_repo01$
Git:Test01:Datafiles:
administrator@srv-ubuntu:~/Local_repo01$ cd ~/Local_repo01administrator@srv-ubuntu:~/Local_repo01$ touch datafiles/data01.txt
administrator@srv-ubuntu:~/Local_repo01$ ls > test01
administrator@srv-ubuntu:~/Local_repo01$ cat test01
datafiles
test01
administrator@srv-ubuntu:~/Local_repo01$ echo "abcd" > test02
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$ cat test02
abcd
administrator@srv-ubuntu:~/Local_repo01$ ls -la /tmp > test03
administrator@srv-ubuntu:~/Local_repo01$ cat test0
test01 test02 test03
administrator@srv-ubuntu:~/Local_repo01$ cat test03
total 16
drwxrwxrwt 4 root root 4096 Jul 26 11:17 .
drwxr-xr-x 23 root root 4096 Jul 21 00:01 ..
drwxrwxrwt 2 root root 4096 Jul 26 11:04 VMwareDnD
drwx------ 2 root root 4096 Jul 26 11:04 vmware-root
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# datafiles/
# test01
# test02
# test03
nothing added to commit but untracked files present (use "git add" to track) --Check this line
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$ git log
fatal: bad default revision 'HEAD' --No Logs
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$ git add .
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: datafiles/data01.txt
# new file: test01
# new file: test02
# new file: test03
# --Check above blueline missing after git add
administrator@srv-ubuntu:~/Local_repo01$ git log
fatal: bad default revision 'HEAD' --No Logs
administrator@srv-ubuntu:~/Local_repo01$ git commit -m "Test first commit"
[master (root-commit) dc65e3b] Test first commit
3 files changed, 8 insertions(+)
create mode 100644 datafiles/data01.txt
create mode 100644 test01
create mode 100644 test02
create mode 100644 test03
administrator@srv-ubuntu:~/Local_repo01$ git log --After first commit log is there
commit dc65e3b2bcda28552099ccf663bd7eeec5d6e6f8
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:12:14 2013 +0530
Test first commit
administrator@srv-ubuntu:~/Local_repo01$
Git:Test01:File-Structure:
administrator@srv-ubuntu:~/Local_repo01$ tree -La 2.
|-- datafiles
| `-- data01.txt
|-- .git
| |-- branches
| |-- COMMIT_EDITMSG
| |-- config
| |-- description
| |-- HEAD
| |-- hooks
| |-- index
| |-- info
| |-- logs
| |-- objects
| `-- refs
|-- test01
|-- test02
`-- test03
8 directories, 9 files
Git:Remove-Test01:
administrator@srv-ubuntu:~/Local_repo01$ touch removetest.txtadministrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$ tree -La 2
.
|-- datafiles
| `-- data01.txt
|-- .git
| |-- branches
| |-- COMMIT_EDITMSG
| |-- config
| |-- description
| |-- HEAD
| |-- hooks
| |-- index
| |-- info
| |-- logs
| |-- objects
| `-- refs
|-- removetest.txt
|-- test01
|-- test02
`-- test03
8 directories, 10 files
administrator@srv-ubuntu:~/Local_repo01$ git add .
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: removetest.txt
#
administrator@srv-ubuntu:~/Local_repo01$ git log
commit dc65e3b2bcda28552099ccf663bd7eeec5d6e6f8
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:12:14 2013 +0530
Test first commit
administrator@srv-ubuntu:~/Local_repo01$ git commit -m "remove test"
[master 7919cb1] remove test
0 files changed
create mode 100644 removetest.txt
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
nothing to commit (working directory clean)
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$ git log
commit 7919cb1d8b3e8c740fa9c282f0f6290b0f5db48e
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:16:22 2013 +0530
remove test
commit dc65e3b2bcda28552099ccf663bd7eeec5d6e6f8
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:12:14 2013 +0530
Test first commit
administrator@srv-ubuntu:~/Local_repo01$ git rm removetest.txt
rm 'removetest.txt'
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: removetest.txt
#
administrator@srv-ubuntu:~/Local_repo01$ git log
commit 7919cb1d8b3e8c740fa9c282f0f6290b0f5db48e
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:16:22 2013 +0530
remove test
commit dc65e3b2bcda28552099ccf663bd7eeec5d6e6f8
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:12:14 2013 +0530
Test first commit
administrator@srv-ubuntu:~/Local_repo01$ git commit -m "Removes removetest.txt file"
[master 2fbb331] Removes removetest.txt file
0 files changed
delete mode 100644 removetest.txt
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
nothing to commit (working directory clean)
administrator@srv-ubuntu:~/Local_repo01$ git log
commit 2fbb33173596050ac5d2ab1eb6a0d046bc190900
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:17:07 2013 +0530
Removes removetest.txt file
commit 7919cb1d8b3e8c740fa9c282f0f6290b0f5db48e
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:16:22 2013 +0530
remove test
commit dc65e3b2bcda28552099ccf663bd7eeec5d6e6f8
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:12:14 2013 +0530
Test first commit
administrator@srv-ubuntu:~/Local_repo01$
Git:Remove-Test02(Removing file without "git rm" command):
administrator@srv-ubuntu:~/Local_repo01$ touch removetest02.txtadministrator@srv-ubuntu:~/Local_repo01$ git add .
administrator@srv-ubuntu:~/Local_repo01$ git commit -m "a new file created removetest02.txt"
[master 1e7baa1] a new file created removetest02.txt
0 files changed
create mode 100644 removetest02.txt
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
nothing to commit (working directory clean)
administrator@srv-ubuntu:~/Local_repo01$ git log
commit 1e7baa143de1c10d09216248087f9d34f9a7eebb
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:20:33 2013 +0530
a new file created removetest02.txt
commit 2fbb33173596050ac5d2ab1eb6a0d046bc190900
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:17:07 2013 +0530
Removes removetest.txt file
commit 7919cb1d8b3e8c740fa9c282f0f6290b0f5db48e
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:16:22 2013 +0530
remove test
commit dc65e3b2bcda28552099ccf663bd7eeec5d6e6f8
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:12:14 2013 +0530
Test first commit
administrator@srv-ubuntu:~/Local_repo01$ rm removetest02.txt
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: removetest02.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$ ls -la
total 28
drwxrwxr-x 4 administrator administrator 4096 Jul 26 12:23 .
drwxr-xr-x 10 administrator administrator 4096 Jul 26 11:39 ..
drwxrwxr-x 2 administrator administrator 4096 Jul 26 11:47 datafiles
drwxrwxr-x 8 administrator administrator 4096 Jul 26 12:23 .git
-rw-rw-r-- 1 administrator administrator 17 Jul 26 11:47 test01
-rw-rw-r-- 1 administrator administrator 5 Jul 26 11:47 test02
-rw-rw-r-- 1 administrator administrator 204 Jul 26 11:47 test03
administrator@srv-ubuntu:~/Local_repo01$ git add .
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: removetest02.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
administrator@srv-ubuntu:~/Local_repo01$ git commit -m "file NOT removed from GIT"
# On branch master
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: removetest02.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: removetest02.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$ git commit -a -m "File removetest02.txt is now removed"
[master 5b81ade] File removetest02.txt is now removed
0 files changed
delete mode 100644 removetest02.txt
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
nothing to commit (working directory clean)
Git:Undoing Things:Changing Your Last Commit (--amend command):
administrator@srv-ubuntu:~/Local_repo01$ touch committest.txtadministrator@srv-ubuntu:~/Local_repo01$ git add .
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: committest.txt
#
administrator@srv-ubuntu:~/Local_repo01$ git commit -m "typong messahe msstake-NOK"
[master 2000cd6] typong messahe msstake-NOK
0 files changed
create mode 100644 committest.txt
administrator@srv-ubuntu:~/Local_repo01$
administrator@srv-ubuntu:~/Local_repo01$ git status
# On branch master
nothing to commit (working directory clean)
administrator@srv-ubuntu:~/Local_repo01$ git log
commit 2000cd6d657baa50e0c41aa4516ef8d1542e7bc9
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:34:04 2013 +0530
typong messahe msstake-NOK --Mistake in comment - Part 1
commit 5b81ade3e474a7bfdef29cbf89e186ffeb9b9530
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:26:27 2013 +0530
File removetest02.txt is now removed
commit 1e7baa143de1c10d09216248087f9d34f9a7eebb
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:20:33 2013 +0530
a new file created removetest02.txt
commit 2fbb33173596050ac5d2ab1eb6a0d046bc190900
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:17:07 2013 +0530
Removes removetest.txt file
commit 7919cb1d8b3e8c740fa9c282f0f6290b0f5db48e
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:16:22 2013 +0530
remove test
commit dc65e3b2bcda28552099ccf663bd7eeec5d6e6f8
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:12:14 2013 +0530
Test first commit
administrator@srv-ubuntu:~/Local_repo01$ git commit --amend -m "typing message mistake - now correct-OK"
[master 790114e] typing message mistake - now correct-OK
0 files changed
create mode 100644 committest.txt
administrator@srv-ubuntu:~/Local_repo01$ git log
commit 790114e67f113061d4bcececc94bc74ba368bb76
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:34:04 2013 +0530
typing message mistake - now correct-OK --Mistake in Part 1:Corrected
commit 5b81ade3e474a7bfdef29cbf89e186ffeb9b9530
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:26:27 2013 +0530
File removetest02.txt is now removed
commit 1e7baa143de1c10d09216248087f9d34f9a7eebb
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:20:33 2013 +0530
a new file created removetest02.txt
commit 2fbb33173596050ac5d2ab1eb6a0d046bc190900
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:17:07 2013 +0530
Removes removetest.txt file
commit 7919cb1d8b3e8c740fa9c282f0f6290b0f5db48e
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:16:22 2013 +0530
remove test
commit dc65e3b2bcda28552099ccf663bd7eeec5d6e6f8
Author: Rajesh <rajeshp2408@gmail.com>
Date: Fri Jul 26 12:12:14 2013 +0530
Test first commit
administrator@srv-ubuntu:~/Local_repo01$
Comments
Post a Comment