GIT
Download :
https://git-scm.com/downloads
Click the one above link to down
load the Git software.
Installation:
Click on the machine OS
supported, for windows click on the download for windows.
Click on the OS bit version as
per your PC or laptop supported, it will download.
Checking the GIT version.
GIT -HUB account Creation:
Click on this link : https://github.com/
Open Gmail account check mail from GitHub for code and enter the code.
GIT HUB Account creation is completed
:----Account creation END -----:
Create a Repository:
:----Create Repository END -----:
GIT configuration:
git config --global user.name "Sainath Kota"
git config --global user.email "sainath.kota@gmail.com"
Remove an entry in global configuration: git config --global --unset user.name
git config --global --unset user.email
Example: git config --global --unset "Advaith.Kota"
git config --global --unset "Advaith.kota@gmail.com"
git config --global --replace-all user.name "Your New Name"
git config --global --replace-all user.email "Your new email"
Initializing a new repository:
Open git bash in new folder , where you want open a new repository and initialize.
git init
Git- Add. (workspace to staging/index)
- git add (filename),
- git add * (or) git add .
Git- Commit. (Staging/Index to Local Repository)
Note : workspace file names in Red color.
staging/index area files in Green color.
<< adding multiple files from workspace to staging/index area >>
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/sainath (master)
$ touch file2 file3 file4
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/sainath (master)
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
file2
file3
file4
nothing added to commit but untracked files present (use "git add" to track)
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/sainath (master)
$ git add *
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/sainath (master)
$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: file2
new file: file3
new file: file4
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/sainath (master)
$ git commit -m "multiple files"
[master 2152126] multiple files
3 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file2
create mode 100644 file3
create mode 100644 file4
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/sainath (master)
$ git status
On branch master
nothing to commit, working tree clean
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/sainath (master)
$
- git show cid << Commit ID >>
Git reset head. (staging/index to workspace)- git reset head <<File_name>>
git reset head index_2_work
Git reset soft cid (n-1) ( Local repository to staging/index )
- git reset --soft <<cid(n-1)>>
Note : "48c14eb748d5c8bf093b27a42128c17f99f684de" OLD commit ID- git reset --soft "48c14eb748d5c8bf093b27a42128c17f99f684de"
Git reset mixed (Local repository to workspace)
- git reset --mixed <<cid(n-1)>>
Note : "23887476526a5292f1575b68907ae88e32e1a57d" OLD commit ID
git reset --mix 23887476526a5292f1575b68907ae88e32e1a57d
Git- Clone Repository:
Git Push ( Local repository to Remote Respository )
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/Advaith (master)
$ cd Advaith_repo/
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/Advaith/Advaith_repo (main)
$ ls -lrt
total 0
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/Advaith/Advaith_repo (main)
$ touch hub1 hub2
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/Advaith/Advaith_repo (main)
$ git status
On branch main
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
hub1
hub2
nothing added to commit but untracked files present (use "git add" to track)
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/Advaith/Advaith_repo (main)
$ git add .
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/Advaith/Advaith_repo (main)
$ git commit -m "upload to hub"
[main (root-commit) daa4a7c] upload to hub
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hub1
create mode 100644 hub2
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/Advaith/Advaith_repo (main)
$ git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 217 bytes | 217.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/sainathkota/Advaith_repo.git
* [new branch] main -> main
Advaith@DESKTOP-3NCKQQC MINGW64 /g/DEVOPS/Git/Advaith/Advaith_repo (main)
$
Check in Git-Hub
Git- LOG
- git log << It will display all the logs , to quit press q >>
- git log –n << it will display latest logs >>
- git log
--author= << name >>
- git log
--author=name –oneline
- git log
--author=name --oneline –n
- git log
--since=yy-mm-dd (or) git log
--after=yy-mm-dd
This is display all the logs after May 7th 23:40 hours:
- git log
--until=yy-mm-dd (or) git log
--before=yy-mm-dd
This is display all the logs before April 15th 21:00 hour

- git log
--since=yy-mm-dd --until=yy-mm-dd
or
git log
--after=yy-mm-dd --before=yy-mm-dd
Display all the logs after "April 21st 21:00 hour" to "Before May 1st 19:59 hour"
git log
--after="2022-04-21 21:00" --before="2022-05-01 19:59"
Display all the logs with commit label "sai"
- git log --
file file-name
Display all the logs commits with respect to that file name.
Comments
Post a Comment