Introduction to Git
Before we start running Git commands, let's discuss the basic structure of Git. Git manages files in repositories. Repositories track changes to the files over a period of time and hold the history of what was changed, when it was changed, and who changed it. Files move between your working directory, staging area, local repository, and the remote repository. To understand this better, let's look at the overall flow of Git.
Git follows a specific flow to manage file versions locally and remotely. To maintain different versions, Git uses the concept of repositories. A repository is a folder inside your workspace and contains the suffix .git
in its name. To understand how this folder is created and how versions are managed, let's look at the following figure:
The preceding figure shows the overall Git flow; let's look at each step in detail using an example.