Git + CentOS + Step by Step
Install the git
yum install git
Define Global variables
[root@GOLDMASTER ~]# git config --global user.name "myName"
[root@GOLDMASTER ~]# git config --global user.email "myName@myDomain.com"
Make a directory where you want your repository
[root@GOLDMASTER ~]# mkdir /opt/repository
[root@GOLDMASTER ~]# cd /opt/repository/
[root@GOLDMASTER repository]# git config --global color.ui auto
Make your repositry
[root@GOLDMASTER repository]# mkdir project
[root@GOLDMASTER repository]# cd project/
Initialize the repository
[root@GOLDMASTER project]# git init
Initialized empty Git repository in /opt/repository/project/.git/
It will create a .git directory
[root@GOLDMASTER project]# ls -la
total 12
drwxr-xr-x 3 root root 4096 Nov 5 19:47 .
drwxr-xr-x 4 root root 4096 Nov 5 19:47 ..
drwxr-xr-x 7 root root 4096 Nov 5 19:47 .git
[root@GOLDMASTER project]#
Add docs and files in the repository
[root@GOLDMASTER project]# mkdir docs
[root@GOLDMASTER project]# cd docs/
[root@GOLDMASTER docs]# vim testdoc.txt
[root@GOLDMASTER docs]# cd ..
[root@GOLDMASTER project]# ls
docs
[root@GOLDMASTER project]# git add .
[root@GOLDMASTER project]# git commit -m " my first commit"
[master (root-commit) 600533f] my first commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 docs/testdoc.txt
Each time you make a change you want to track, you need to commit it.
In Git committing a change and sharing that change are two different processes...which is not a case in CVS.
Clone the Project Repository
[root@GOLDMASTER repository]# ls
project
[root@GOLDMASTER repository]# git clone project/ /var/local/project
Initialized empty Git repository in /var/local/project/.git/
[root@GOLDMASTER repository]#
Install the git
yum install git
Define Global variables
[root@GOLDMASTER ~]# git config --global user.name "myName"
[root@GOLDMASTER ~]# git config --global user.email "myName@myDomain.com"
Make a directory where you want your repository
[root@GOLDMASTER ~]# mkdir /opt/repository
[root@GOLDMASTER ~]# cd /opt/repository/
[root@GOLDMASTER repository]# git config --global color.ui auto
Make your repositry
[root@GOLDMASTER repository]# mkdir project
[root@GOLDMASTER repository]# cd project/
Initialize the repository
[root@GOLDMASTER project]# git init
Initialized empty Git repository in /opt/repository/project/.git/
It will create a .git directory
[root@GOLDMASTER project]# ls -la
total 12
drwxr-xr-x 3 root root 4096 Nov 5 19:47 .
drwxr-xr-x 4 root root 4096 Nov 5 19:47 ..
drwxr-xr-x 7 root root 4096 Nov 5 19:47 .git
[root@GOLDMASTER project]#
Add docs and files in the repository
[root@GOLDMASTER project]# mkdir docs
[root@GOLDMASTER project]# cd docs/
[root@GOLDMASTER docs]# vim testdoc.txt
[root@GOLDMASTER docs]# cd ..
[root@GOLDMASTER project]# ls
docs
[root@GOLDMASTER project]# git add .
[root@GOLDMASTER project]# git commit -m " my first commit"
[master (root-commit) 600533f] my first commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 docs/testdoc.txt
Each time you make a change you want to track, you need to commit it.
In Git committing a change and sharing that change are two different processes...which is not a case in CVS.
Clone the Project Repository
[root@GOLDMASTER repository]# ls
project
[root@GOLDMASTER repository]# git clone project/ /var/local/project
Initialized empty Git repository in /var/local/project/.git/
[root@GOLDMASTER repository]#
If you create the file ~/.gitconfig & put write the below lines then you can create the aliases as shown below.
[user]
name = YOUR NAME
email = you@yourDomain.com
[alias]
st = status
di = diff
co = checkout
ci = commit -am
br = branch
brr = branch -r
bra = branch -a
sta = stash
pl = pull
ps = push
lg = log --graph --pretty=format:'%Cred%h%Creset
-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
--abbrev-commit --date=relative
wc = whatchanged --pretty=oneline
[color]
ui = true
diff = auto
status = auto
branch = auto
[push]
default = tracking
[color "branch"]
current = green bold
local = yellow
remote = green
[color "diff"]
meta = cyan bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = magenta
changed = green
untracked = cyan
[core]
pager = less -FRSX
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = /home/YOU/.gitignore
editor = vim
autocrlf = input
quotepath = false
[merge]
tool = vimdiff
[apply]
whitespace = warn
[gc]
reflogexpire = 300
reflogexpireunreachable = 90
[format]
pretty = %C(yellow)%h%Creset %s %C(red)(%cr)%Creset
[github]
user = YOU
token = YOURS
# vi:filetype=gitconfig:tabstop=2:expandtab