A topic in the Open Knowledge Graph — a free, open map of 15,495 topics and the order to learn them in.

Version Control with Git

College Depth 88 in the knowledge graph ☐ I know this ☆ Set as goal
344prerequisites beneath it
See this on the map →
File I/O BasicsProgram Structure and Control Flow+1 more→
version-control git commits branches merging software-engineering collaboration

Core Idea

A version control system records the history of a project's files so that any earlier state can be inspected or restored, and so that several people can work on the same code without overwriting each other. Git, created by Linus Torvalds in 2005 for Linux kernel development, is the most widely used system. In Git, a commit is a saved snapshot of the project with a message, an author and a link to the commit before it. Branches let work proceed on separate lines of history that can later be merged.

How It's Best Learned

Use Git on a real, small project from the first day: init, edit, check `git status`, stage with `git add`, commit with a clear message, and view `git log`. Draw the commit history as a chain of boxes, and redraw it after each branch and merge. Create a merge conflict on purpose in pairs, so that resolving one becomes a routine skill rather than a crisis.

Common Misconceptions

Explainer

Without version control, people save copies with names like `essay_final_v2_REAL.docx`. That habit fails quickly for code. You cannot tell which copy has which fix, and two people editing at once will overwrite each other. A version control system solves both problems by keeping a full, ordered history of a project.

Git stores a project in a repository, a folder plus a hidden `.git` directory that holds the history. Work follows a simple cycle. You edit files in the working tree. You choose which changes belong together and stage them with `git add`. Then `git commit -m "Add login check"` saves a commit: a snapshot of the staged project, your message, your name, the time, and a pointer to the previous commit. Each commit gets a unique ID computed from its contents, a hash such as `3f2a9c1...`. `git status` shows what has changed and what is staged, and `git log` lists the history.

Because every commit is kept, you can see exactly what changed between versions with `git diff`, and you can return to an earlier state if a change breaks the program. Good commits are small and focused, with messages that explain why the change was made.

Branches let history split. A branch is a movable name that points at a commit. You might create `feature-search` with `git switch -c feature-search`, make several commits there, and leave `main` untouched. When the feature works, `git merge feature-search` on `main` combines the two lines of history. If both branches changed different parts of the code, Git merges them automatically. If both changed the same lines differently, Git reports a merge conflict, marks the competing versions in the file, and waits for you to edit the result and commit it.

Git is distributed. `git clone` copies the whole repository, including all history, to your machine. You can commit offline. To share work, you `git push` your commits to a shared remote repository and `git pull` other people's commits from it. Services such as GitHub, GitLab and Bitbucket host those remotes and add review tools, but Git itself is separate from them.

Version control pays off even when working alone. It gives you an undo button for the whole project and a record of why each change was made.

Practice Questions 4 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Combining Small Groups Within 5 → Number Bonds Within 5 → Number Bonds to 10 → Tens and Ones Place Value → Reading and Writing Three-Digit Numbers → Comparing Three-Digit Numbers → Comparing and Ordering Three-Digit Quantities → Comparing and Ordering Whole Numbers → Comparing Numbers 1 to 20 → Ordering Numbers to 20 → Number Line 0 to 20 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Opposites and Additive Inverses → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Conditional Statements → Defining and Calling Functions → Functions: Decomposing Problems → Function Parameters and Argument Passing → Return Values → Function Design and Contracts → Testing and Validation Basics → Version Control with Git

Longest path: 89 steps · 344 total prerequisite topics

Prerequisites (3)

Leads To (0)

No topics depend on this one yet.