Overview

Contents

Overview#

This is an entry page containing basic information you need to know to start working with git. Some sections refer to specific pages that provide more detailed descriptions of various git concepts with more advanced examples.

Repository#

This section discusses what a git repository is and what a typical folder needs to have to be considered a git repository.

You should use the git init command to create a new repository. This command adds a .git folder to the directory being initialized as a repository - this folder serves as a marker indicating that the directory is a git repository.


The following cell creates a folder and initializes a repository in it. This allows you to see the typical messages provided by git during these operations.

mkdir /tmp/git_init
cd /tmp/git_init

git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /tmp/git_init/.git/

Check what the empty folder looks like after running git init.

ls -la
total 20
drwxrwxr-x  3 fedor fedor  4096 Jan  8 18:47 .
drwxrwxrwt 43 root  root  12288 Jan  8 18:50 ..
drwxrwxr-x  7 fedor fedor  4096 Jan  8 18:47 .git

There is a .git folder which contains all the files that git uses to keep track of changes.