Pages

GIT: Appendix I

 

Glossary of Git Terminology

Add

Moves changes from working directory to staging area.

Bare Repository

Repository without working directory, typically used for sharing.

Blame

Shows line-by-line author attribution for a file.

Branch

Independent line of development.

Checkout

Switch working directory to a branch, commit, or file version.

Clone

Create local copy of remote repository.

Commit

Snapshot of repository state with metadata.

Commit Hash

Unique identifier of commit generated via SHA algorithm.

Conflict

Occurs when Git cannot automatically merge changes.

Detached HEAD

State where HEAD points directly to commit instead of branch.

Diff

Shows changes between versions.

Fetch

Retrieve remote changes without merging.

Fork

Independent server-side copy of repository.

HEAD

Pointer to current commit.

Index (Staging Area)

Intermediate layer before commit.

Merge

Combine histories of branches.

Origin

Default name of primary remote repository.

Pull

Fetch followed by merge.

Push

Upload commits to remote.

Rebase

Reapply commits onto different base.

Remote

External repository reference.

Reset

Move branch pointer and optionally modify working state.

Revert

Create new commit undoing previous change.

SHA

Cryptographic identifier for Git objects.

Stash

Temporary storage of uncommitted changes.

Tag

Named reference to specific commit.

Tree

Directory structure snapshot object.

Working Directory

User-visible project files.


Practical Command Reference

Repository Setup

git init
git clone <url>

Configuration

git config --global user.name "Name"
git config --global user.email "email"
git config --list

Basic Workflow

git status
git add .
git commit -m "message"
git log

Branching

git branch
git branch feature
git checkout feature
git switch feature

Merging and Rebasing

git merge feature
git rebase main

Remote Operations

git remote -v
git fetch
git pull
git push

History Inspection

git log --oneline
git diff
git show <commit>

Undo Operations

git reset HEAD file
git reset --hard HEAD
git revert <commit>

Stash

git stash
git stash list
git stash pop

Tagging

git tag v1.0
git push origin v1.0

Hands-on Exercises

Exercise 1 — First Repository

Task

  1. Initialize repository

  2. Create file

  3. Commit change

Outcome
Understand basic workflow.


Exercise 2 — Branch Workflow

Task

  1. Create feature branch

  2. Modify file

  3. Merge to main

Outcome
Learn branch isolation and merge.


Exercise 3 — Conflict Resolution

Task

  1. Modify same line in two branches

  2. Merge branches

  3. Resolve conflict

Outcome
Develop conflict management skill.


Exercise 4 — Remote Collaboration

Task

  1. Clone repository

  2. Create branch

  3. Push branch

  4. Open pull request

Outcome
Practice collaborative workflow.


Exercise 5 — Recovery

Task

  1. Delete commit via reset

  2. Restore using reflog

Outcome
Learn recovery mechanisms.


Case Studies

Case Study 1 — Startup Team Collaboration

Context

Small distributed team building web application.

Challenges

  • Frequent changes

  • Integration issues

  • Lack of review process

Solution

  • Feature branch model

  • Pull request review

  • CI integration

Outcome

  • Reduced defects

  • Improved collaboration

  • Faster releases


Case Study 2 — Enterprise Monorepo Migration

Context

Large organization consolidating multiple repositories.

Challenges

  • Dependency fragmentation

  • Cross-team coordination

  • Build inconsistency

Solution

  • Monorepo architecture

  • Sparse checkout

  • Central CI pipeline

Outcome

  • Improved visibility

  • Atomic cross-system changes

  • Standardized tooling


Case Study 3 — DevOps GitOps Adoption

Context

Infrastructure managed manually.

Challenges

  • Configuration drift

  • Audit gaps

  • Slow provisioning

Solution

  • Infrastructure as Code

  • GitOps workflow

  • Automated reconciliation

Outcome

  • Deterministic environments

  • Auditability

  • Reduced manual operations


Appendix Materials


Appendix A — Git File Status Lifecycle

Untracked → Modified → Staged → Committed

Appendix B — Git Object Model

ObjectPurpose
BlobFile data
TreeDirectory structure
CommitSnapshot metadata
TagNamed reference

Appendix C — Branching Models Overview

ModelCharacteristics
Feature branchIsolated development
GitflowStructured release cycles
Trunk-basedShort-lived branches
Fork workflowExternal contributions

Appendix D — Common Git Aliases

git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.cm commit
git config --global alias.lg "log --oneline --graph"

Appendix E — Recommended Learning Path

  1. Basic workflow mastery

  2. Branching and merging

  3. Collaboration workflows

  4. History manipulation

  5. Advanced operations

  6. Automation and DevOps integration


Appendix F — Troubleshooting Quick Reference

IssueAction
Wrong commit messageamend
Lost commitreflog
Merge conflictmanual resolution
Large repo slowgc and maintenance
Push rejectedpull/rebase

No comments:

Post a Comment