
Domains
Agile Management
Master Agile methodologies for efficient and timely project delivery.
View All Agile Management Coursesicon-refresh-cwCertifications
Scrum Alliance
16 Hours
Best Seller
Certified ScrumMaster (CSM) CertificationScrum Alliance
16 Hours
Best Seller
Certified Scrum Product Owner (CSPO) CertificationScaled Agile
16 Hours
Trending
Leading SAFe 6.0 CertificationScrum.org
16 Hours
Professional Scrum Master (PSM) CertificationScaled Agile
16 Hours
SAFe 6.0 Scrum Master (SSM) CertificationAdvanced Certifications
Scaled Agile, Inc.
32 Hours
Recommended
Implementing SAFe 6.0 (SPC) CertificationScaled Agile, Inc.
24 Hours
SAFe 6.0 Release Train Engineer (RTE) CertificationScaled Agile, Inc.
16 Hours
Trending
SAFe® 6.0 Product Owner/Product Manager (POPM)IC Agile
24 Hours
ICP Agile Certified Coaching (ICP-ACC)Scrum.org
16 Hours
Professional Scrum Product Owner I (PSPO I) TrainingMasters
32 Hours
Trending
Agile Management Master's Program32 Hours
Agile Excellence Master's ProgramOn-Demand Courses
Agile and ScrumRoles
Scrum MasterTech Courses and Bootcamps
Full Stack Developer BootcampAccreditation Bodies
Scrum AllianceTop Resources
Scrum TutorialProject Management
Gain expert skills to lead projects to success and timely completion.
View All Project Management Coursesicon-standCertifications
PMI
36 Hours
Best Seller
Project Management Professional (PMP) CertificationAxelos
32 Hours
PRINCE2 Foundation & Practitioner CertificationAxelos
16 Hours
PRINCE2 Foundation CertificationAxelos
16 Hours
PRINCE2 Practitioner CertificationSkills
Change ManagementMasters
Job Oriented
45 Hours
Trending
Project Management Master's ProgramUniversity Programs
45 Hours
Trending
Project Management Master's ProgramOn-Demand Courses
PRINCE2 Practitioner CourseRoles
Project ManagerAccreditation Bodies
PMITop Resources
Theories of MotivationCloud Computing
Learn to harness the cloud to deliver computing resources efficiently.
View All Cloud Computing Coursesicon-cloud-snowingCertifications
AWS
32 Hours
Best Seller
AWS Certified Solutions Architect - AssociateAWS
32 Hours
AWS Cloud Practitioner CertificationAWS
24 Hours
AWS DevOps CertificationMicrosoft
16 Hours
Azure Fundamentals CertificationMicrosoft
24 Hours
Best Seller
Azure Administrator CertificationMicrosoft
45 Hours
Recommended
Azure Data Engineer CertificationMicrosoft
32 Hours
Azure Solution Architect CertificationMicrosoft
40 Hours
Azure DevOps CertificationAWS
24 Hours
Systems Operations on AWS Certification TrainingAWS
24 Hours
Developing on AWSMasters
Job Oriented
48 Hours
New
AWS Cloud Architect Masters ProgramBootcamps
Career Kickstarter
100 Hours
Trending
Cloud Engineer BootcampRoles
Cloud EngineerOn-Demand Courses
AWS Certified Developer Associate - Complete GuideAuthorized Partners of
AWSTop Resources
Scrum TutorialIT Service Management
Understand how to plan, design, and optimize IT services efficiently.
View All DevOps Coursesicon-git-commitCertifications
Axelos
16 Hours
Best Seller
ITIL 4 Foundation CertificationAxelos
16 Hours
ITIL Practitioner CertificationPeopleCert
16 Hours
ISO 14001 Foundation CertificationPeopleCert
16 Hours
ISO 20000 CertificationPeopleCert
24 Hours
ISO 27000 Foundation CertificationAxelos
24 Hours
ITIL 4 Specialist: Create, Deliver and Support TrainingAxelos
24 Hours
ITIL 4 Specialist: Drive Stakeholder Value TrainingAxelos
16 Hours
ITIL 4 Strategist Direct, Plan and Improve TrainingOn-Demand Courses
ITIL 4 Specialist: Create, Deliver and Support ExamTop Resources
ITIL Practice TestData Science
Unlock valuable insights from data with advanced analytics.
View All Data Science Coursesicon-dataBootcamps
Job Oriented
6 Months
Trending
Data Science BootcampJob Oriented
289 Hours
Data Engineer BootcampJob Oriented
6 Months
Data Analyst BootcampJob Oriented
288 Hours
New
AI Engineer BootcampSkills
Data Science with PythonRoles
Data ScientistOn-Demand Courses
Data Analysis Using ExcelTop Resources
Machine Learning TutorialDevOps
Automate and streamline the delivery of products and services.
View All DevOps Coursesicon-terminal-squareCertifications
DevOps Institute
16 Hours
Best Seller
DevOps Foundation CertificationCNCF
32 Hours
New
Certified Kubernetes AdministratorDevops Institute
16 Hours
Devops LeaderSkills
KubernetesRoles
DevOps EngineerOn-Demand Courses
CI/CD with Jenkins XGlobal Accreditations
DevOps InstituteTop Resources
Top DevOps ProjectsBI And Visualization
Understand how to transform data into actionable, measurable insights.
View All BI And Visualization Coursesicon-microscopeBI and Visualization Tools
Certification
24 Hours
Recommended
Tableau CertificationCertification
24 Hours
Data Visualization with Tableau CertificationMicrosoft
24 Hours
Best Seller
Microsoft Power BI CertificationTIBCO
36 Hours
TIBCO Spotfire TrainingCertification
30 Hours
Data Visualization with QlikView CertificationCertification
16 Hours
Sisense BI CertificationOn-Demand Courses
Data Visualization Using Tableau TrainingTop Resources
Python Data Viz LibsCyber Security
Understand how to protect data and systems from threats or disasters.
View All Cyber Security Coursesicon-refresh-cwCertifications
CompTIA
40 Hours
Best Seller
CompTIA Security+EC-Council
40 Hours
Certified Ethical Hacker (CEH v12) CertificationISACA
22 Hours
Certified Information Systems Auditor (CISA) CertificationISACA
40 Hours
Certified Information Security Manager (CISM) Certification(ISC)²
40 Hours
Certified Information Systems Security Professional (CISSP)(ISC)²
40 Hours
Certified Cloud Security Professional (CCSP) Certification16 Hours
Certified Information Privacy Professional - Europe (CIPP-E) CertificationISACA
16 Hours
COBIT5 Foundation16 Hours
Payment Card Industry Security Standards (PCI-DSS) CertificationOn-Demand Courses
CISSPTop Resources
Laptops for IT SecurityWeb Development
Learn to create user-friendly, fast, and dynamic web applications.
View All Web Development Coursesicon-codeBootcamps
Career Kickstarter
6 Months
Best Seller
Full-Stack Developer BootcampJob Oriented
3 Months
Best Seller
UI/UX Design BootcampEnterprise Recommended
6 Months
Java Full Stack Developer BootcampCareer Kickstarter
490+ Hours
Front-End Development BootcampCareer Accelerator
4 Months
Backend Development Bootcamp (Node JS)Skills
ReactOn-Demand Courses
Angular TrainingTop Resources
Top HTML ProjectsBlockchain
Understand how transactions and databases work in blockchain technology.
View All Blockchain Coursesicon-stop-squareBlockchain Certifications
40 Hours
Blockchain Professional Certification32 Hours
Blockchain Solutions Architect Certification32 Hours
Blockchain Security Engineer Certification24 Hours
Blockchain Quality Engineer Certification5+ Hours
Blockchain 101 CertificationOn-Demand Courses
NFT Essentials 101: A Beginner's GuideTop Resources
Blockchain Interview QsProgramming
Learn to code efficiently and design software that solves problems.
View All Programming Coursesicon-codeSkills
Python CertificationInterview Prep
Career Accelerator
3 Months
Software Engineer Interview PrepOn-Demand Courses
Data Structures and Algorithms with JavaScriptTop Resources
Python TutorialGit objects are the metadata stored under .git/objects repository. There are 4 types of git objects:
Git commit, git trees, git blobs and git tags.
Each commit object is uniquely identified by a git hash code (SHA-1).
Every commit made creates a new commit object that stores a reference to the tree object, blob files, and tags if any.
Refer: git commit object diagram
Hooks are the metadata objects in the .git directory created at the time of ‘git init .<directory>’ command.
These scripts are like triggers that get executed pre or post an action or event; such as a command run.
Every git repository comes installed with prebuilt hooks scripts in the .git/hooks directory; that a user can edit as per the project’s requirement.
There are two groups of these hooks: client-side and server-side.
Client-side hooks:
These are hooks installed and maintained on the developers local repository and are executed when events on the local repository are triggered, such as commit and merge and rebase.
Server-side hooks:
These hooks installed on Server on network operations such as receiving pushed commits.
Project: hooksProj

hooksProj [master] $ls -1 .git/hooks/
applypatch-msg.sample
commit-msg.sample
fsmonitor-watchman.sample
post-update.sample
pre-applypatch.sample
pre-commit.sample
pre-push.sample
pre-rebase.sample
pre-receive.sample
prepare-commit-msg.sample
update.sample
To enable a hook script, rename the script to the same name truncating the .sample extension.
However if you write your own hook scripts, write it in Shell language and place it under .git/hooks folder of your project and make them executable as :
git chmod +x <script_name>
Scripts are listed in the order of their execution.

hooks [topic] $ls -1 *commit*
pre-commit
prepare-commit-msg
commit-msg
post-commit
Current project state: 
hooksProj [topic] $git status
On branch topic
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: README
hooksProj [topic] $git commit
--------------------------------------------
Step 1: Running .git/hooks/pre-commit script.
WARNING!!! Aborting the commit. Found Deleted files in the Staging area.
README
‘pre-commit’ hook fails.
‘pre-commit’ script runs a test before making a commit
#Aim: Check for any Deleted file in the staging area, if any it stops you from committing this snapshot.
Step 2: Reset the project back to HEAD commit and add/modify any file(README).

[topic] $git status
On branch topic
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: README
Add files to staging area and commit:
git commit
--This opens up the editor:
Add date in README.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch topic
# Changes to be committed:
# modified: README
#
ISSUE#7092
‘prepare-commit-msg’ hook:
#Aim: Appends the commit message and display the list of staged files that were committed.
Step 3: Remove the line ISSUE# while saving the message.

hooksProj [topic] $git commit
--------------------------------------------
Step 1: Running .git/hooks/pre-commit script.
[OK]: No deleted files, proceed to commit.
--------------------------------------------
Step 2: Running .git/hooks/prepare-commit-msg script.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch topic
# Changes to be committed:
# modified: README
#
ISSUE#7092
Enter your commit message here.
README
--------------------------------------------
Step 3: Running .git/hooks/commit-msg script.
[NOK]: Missing an ISSUE number in the message
Commit-msg’ hook script fails.
#Aim: Reads the commit log message for ISSUE#.
Step 4: commit again keeping the ISSUE# in the commit message.
hooksProj [topic] $git commit
--------------------------------------------
Step 1: Running .git/hooks/pre-commit script.
[OK]: No deleted files, proceed to commit.
--------------------------------------------
Step 2: Running .git/hooks/prepare-commit-msg script.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch topic
# Changes to be committed:
# modified: README
#
ISSUE#7092
Enter your commit message here.
README
--------------------------------------------
Step 3: Running .git/hooks/commit-msg script.
[OK]: Commit message has an ISSUE number
--------------------------------------------
Step 4: Running .git/hooks/post-commit script.
New commit made:
b33401b Edit README file. ISSUE#7092
[topic b33401b] Edit README file. ISSUE#7092
1 file changed, 1 insertion(+)
post-commit’ script triggered after the commit was made.
Aim# To trigger a report on the latest commit made.
Step 5: All the 4 pre and post commit scripts exited with success status, commit made.

hooksProj [topic] $git hist
* b33401b 2019-01-29 | Edit README file. ISSUE#7092 (HEAD -> topic) [divya bhushan]
* e0a4db8 2019-01-26 | Add README [divya bhushan]
‘pre-rebase’ hook:
The pre-rebase hook is called before git rebase changes anything, making it a good place to make sure something terrible isn’t about to happen.
This hook takes 2 parameters: the upstream branch that the series was forked from, and the branch being rebased. The second parameter is empty when rebasing the current branch. To abort the rebase, exit with a non-zero status.
Write a pre-rebase hook script to abort the rebasing on any branch and additionally, display a WARNING message if the upstream rebase branch is ‘master’.

--pre-rebase hook code:
vi .git/hooks/pre-rebase
--Make the script executable:
chmod +x .git/hooks/pre-rebase
Rebase ‘topic’ branch on ‘dev’ branch

hooksProj [dev] $git rebase dev topic
pre-rebase: rebasing is dangerous, don't do it.
The pre-rebase hook refused to rebase.
Rebase ‘topic’ branch on ‘master’ branch

hooksProj [dev] $git rebase master topic
WARNING!!! upstream branch is master.
You are not allowed to rebase on master
The pre-rebase hook refused to rebase.
Note the difference in output message in each case. Either ways it would not allow you to rebase.
Sever-side hooks:
Server-side hooks work just like local ones, except they reside in server-side repositories (e.g., a central repository, or a developer’s public repository). When attached to the official repository, some of these can serve as a way to enforce policy by rejecting certain commits.
‘localRepo’ acts as a client repository and ‘remoteRepo’ as a Server repository.
‘pre-receive’: Triggered just before a ‘push’ request on the Server, can be written to reject or allow the push operation.
‘update’ hook script: runs after ‘pre-receive’ hook. It gives info on refname(branch/tag) being pushed to, push commits moving from ‘old commit id’ to ‘new commit id’
‘post-update’ hook script: This updates the .git/info/refs file with the latest commitId for every branch.

--localRepo is ahead of remoteRepo
localRepo [dev] $git status
On branch dev
Your branch is ahead of 'origin/dev' by 1 commit.
(use "git push" to publish your local commits)
--Sever side hook scripts:

cd remoteRepo
remoteRepo [dev] $ls -1 .git/hooks/
pre-receive
update
post-update
--Push from localRepo to remoteRepo

localRepo [dev] $git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (2/2), 272 bytes | 272.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0)
remote: pre-recieve hook script
remote: hooks/pre-receive: [NOK]- Abort the push command
remote:
To /Users/Divya1/OneDrive/gitRepos/remoteRepo/
! [remote rejected] dev -> dev (pre-receive hook declined)
error: failed to push some refs to '/Users/Divya1/OneDrive/gitRepos/remoteRepo/'
Edit the ‘pre-receive’ script to allow the push operation on ‘remoteRepo’, other 2 scripts will be auto triggered.

localRepo [dev] $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% (2/2), 272 bytes | 272.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0)
remote:
remote: hooks/pre-receive: [OK] - pre-recieve hook script triggered... allow 'push' operation.
remote:
remote: hooks/update: hooks script triggered...
remote:
remote: hooks/update: Moving refs/heads/dev from 4f7da8d58db3dc7d5faa4015b589918e06c18843 to e7601cd74f44509afbd07538abcfbbcd7c3ca3aa
remote:
remote: hooks/post-update: hooks script triggered...
remote: hooks/post-update: Update .git/info/refs file with the latest commitId for every branch.
To /Users/Divya1/OneDrive/gitRepos/remoteRepo/
4f7da8d..e7601cd dev -> dev
git provides a level of security by means of hook scripts on both client and server side.
It gives you a means to run automated pre and post checks on your repository. Use them wisely.
Refs are also a part of git metadata objects that keeps the references to the commits and tags from each branch.
Refs are stored as objects in the .git/refs directory; Below is the git structure for git refs:

$.git/refs
heads
remotes
stash
tags

$.git/refs/heads
branch_v1.8
feature1
initialBranch
master
topicBranch
Ref is a user-friendly alias for a commit hash.
git reflog: Manage reference logs information
reflog records each and every operation performed by git. Right from a adding files, changing their file permissions to staging, committing, branch managements to remote server connections.
It stores the history in a chronological order. Consider it as a LIFO list.

myProj [master] $git reflog | head
310ddc5 HEAD@{0}: checkout: moving from d1cd65703b8c37c2bd83b634218cab44968cefbe to master
d1cd657 HEAD@{1}: checkout: moving from master to 367b4edcfc3dc652c2e2679d2bc74bc328163966~1
310ddc5 HEAD@{2}: checkout: moving from 367b4edcfc3dc652c2e2679d2bc74bc328163966 to master
367b4ed HEAD@{3}: checkout: moving from master to 367b4edcfc3dc652c2e2679d2bc74bc328163966
310ddc5 HEAD@{4}: commit: Add the Linux iso image.
373c878 HEAD@{5}: cherry-pick: Add LFS object : *.tar file.
9ecf5bd HEAD@{6}: checkout: moving from initialBranch to master
394746e HEAD@{7}: commit: Add LFS object : *.tar file.
bf031f0 HEAD@{8}: commit (amend): Modify git lfs file to track *.tar files.
To see the log of the references use the ‘git show’ command
git show 310ddc5
git show HEAD@{4}
Checkout a reflog snapshot as:
git checkout HEAD@{3}
or
git checkout 367b4ed