GIT for source code management.
To see where is GIT installed:
$ which git
To get the version of GIT:
$ git --version
Configuration:
Three places where GIT stores configuration information
- System - /etc/gitconfig
- User - ~/.gitconfig
- Project - my_project/.git/config
Update configuration:
For System: $ git config --system
For User: $ git config --global
For project:
$ git config
$ git config --global user.name "Mohan Donthabhaktuni"
$ git config --global user.email "mohand.bi@outlook.com"
To view the configuration details:
$ git config user.name (shows the user name)
To view all the configuration details:
$ git config --list
These configuration details get stored in the .gitconfig file under the users home directory
Setup Auto-completion:
$ ~ mohand$ cd ~
$ ~ mohand$ curl -OL https://githum.com/git/git/raw/master/contrib/completion/git-completion.bash
$ mv ~/git-completion.bash ~/.git-completion.bash
Then add the file to the user's profile
Create a directory for project and initialize:
$ git init
$ pwd
/Users/mohand/Documents/python/.git
$ ls -l
total 24
-rw-r--r-- 1 mohand staff 23 Jan 25 19:00 HEAD
drwxr-xr-x 2 mohand staff 68 Jan 25 19:00 branches
-rw-r--r-- 1 mohand staff 137 Jan 25 19:00 config
-rw-r--r-- 1 mohand staff 73 Jan 25 19:00 description
drwxr-xr-x 11 mohand staff 374 Jan 25 19:00 hooks
drwxr-xr-x 3 mohand staff 102 Jan 25 19:00 info
drwxr-xr-x 4 mohand staff 136 Jan 25 19:00 objects
drwxr-xr-x 4 mohand staff 136 Jan 25 19:00 refs
To add a file to the GIT:
$ git add . (adds all the changes made to the project directory to the GIT repository)
To view all the changes made:
$ git log
commit ea11958a7933ac80f26be3793d91485a99365ef2
Author: Mohan Donthabhaktuni <mohand.bi@outlook.com>
Date: Mon Jan 25 19:06:01 2016 -0800
Initial commit
$ git log -n 0
$ git log -n 1
$ git log --since=2012-06-16
$ git log --until=2014-01-31
$ git log --grep="Init"
Initialize GIT to track projects
Change to the directory which needs to be tracked by GIT. Typically the final scripts are to be copied to this place to lock them in GIT.
$ cd PS
mdontha@L7EIS-IAM002 MINGW64 /c/Work/GIT/PS
$ git init
Initialized empty Git repository in C:/Work/GIT/PS/.git/
Commit Changes
git add .
git commit -m "This is for PS"
Comments
Post a Comment