Git

Apr 20, 2024
#cs


Git is a Distributed Version Control System, which means all clients and the remote server have a full copy of the project's history. Contrast this with a Centralized Version Control System, where only the remote server has the full history. A git repository is the .git folder inside your project folder. When you checkout a version, git makes it so the file structure inside your project folder matches that of the version, called the working copy. When you clone a repository, it just copies the .git directory and checks out the latest version. Files can be tracked or untracked. Untracked means git doesn't know about it. When you add a file to the staging area, it will get stored in git's object database, so it'll stay in history forever.

Introduction

Git is a tool used by software engineers to collaborate on projects. The purpose of this post is to understand git well enough to answer questions that might come up on the job, like:

Repository

A software project is basically a folder on your computer that contains code and other files.

Commits

Does Git store diffs or full files?

What is a commit?

What is a branch?

How does merging work?

How does rebasing work?





Comment