Skip to main content

1. What is Git?

Git is a Distributed Version Control System (DVCS) used to track changes in source code. It allows developers to:
  • Track file changes
  • Restore previous versions
  • Collaborate with others
  • Manage different project versions
Git works locally on your computer and stores the entire project history. ([GitHub Docs][1])

2. What is GitHub?

GitHub is a cloud platform that hosts Git repositories. It provides:
  • Cloud backup
  • Collaboration
  • Pull Requests
  • Issues
  • Code Review
  • GitHub Actions (CI/CD)
Difference ([GitHub Docs][1])

3. Version Control System (VCS)

A Version Control System keeps track of every modification. Benefits:
  • Undo mistakes
  • Track history
  • Multiple developers can work together
  • Backup
  • Branching

4. Install Git

Download Git Windows: https://git-scm.com Verify installation

5. Configure Git

Check configuration

6. Git Repository

A Repository (Repo) is a project folder tracked by Git. Types
  • Local Repository
  • Remote Repository

7. Initialize Repository

Creates
hidden folder.

8. Git Workflow


9. Git Status

Shows:
  • Modified files
  • New files
  • Deleted files
  • Staged files

10. Git Add

Stage one file
Stage all files

11. Git Commit

Save snapshot

12. Git Log

Show commit history
Short history

13. Clone Repository

Download GitHub project
Example

14. Remote Repository

Check remote
Add remote

15. Push

Upload code
First Push

16. Pull

Download latest code

17. Fetch

Download changes only
Difference Fetch → Downloads only Pull → Downloads + Merge

18. Branch

Create branch
List branches
Delete branch

19. Switch Branch

or

20. Create and Switch

or

21. Merge

Merge feature branch

22. Merge Conflict

Occurs when two developers modify the same line. Resolve by:
  1. Edit file
  2. Remove conflict markers
  3. Add file
  4. Commit

23. Git Ignore

Ignore files Example
File name

24. Remove File


25. Rename File


26. Undo Changes

Discard changes
Unstage

27. Reset

Soft
Mixed
Hard

28. Revert

Undo commit safely

29. Stash

Save work temporarily
View stash
Restore
Delete

30. Tags

Create
Push

31. Fork

Fork creates your own copy of another person’s GitHub repository. Used in Open Source.

32. Pull Request (PR)

Request to merge code into another branch. Steps Fork Clone Create Branch Commit Push Open Pull Request Review Merge

33. GitHub Issues

Used to:
  • Report bugs
  • Request features
  • Track tasks

34. README.md

Project documentation Contains
  • Project name
  • Installation
  • Usage
  • Features
  • License

35. Markdown Basics

Heading
Bold
Italic
Code
Code Block

36. Common Git Commands Cheat Sheet


37. Complete Git Workflow