Creating repos

Introduction to Git

George Boorman

Curriculum Manager, DataCamp

Mental health in tech project

image of a Git repository containing two files called funding and report, one directory called data, and another called dot-git

Introduction to Git

What is a Git repo?

  • Git repo = directory containing files and sub-directories

Image of a Git repository with two files annotated called funding and report, one directory annotated called data, and another called dot-git

Introduction to Git

What is a Git repo?

  • Git repo = directory containing files and sub-directories, and Git storage

Image of a Git repository with two files annotated called funding and report, one directory annotated called data, and another directory called dot-git, annotated as Git storage

Do not edit .git!

Introduction to Git

Why make a repo?

Benefits of repos

  • Systematically track versions
  • Revert to previous versions
  • Compare versions at different points in time
  • Collaborate with colleagues

Colleagues brainstorming

1 Image credit: https://unsplash.com/@jasongoodman_youxventures
Introduction to Git

Creating a new repo

git init mental-health-workspace
cd mental-health-workspace
git status
On branch main

No commits yet

nothing to commit (create/copy files and use "git add" to track)
Introduction to Git

Converting a project into a repo

  • Convert an existing directory into a Git repo
git init
Initialized empty Git repository in /home/repl/mental-health-workspace/.git/
Introduction to Git

What is being tracked?

git status
On branch main

No commits yet

Untracked files:
    (use "git add <file>..." to include what will be committed)

        data/
        report.md

nothing added to commit but untracked files present (use "git add" to track)
  • Git recognizes there are modified files not being tracked!
Introduction to Git

Nested repositories

  • Don't create a Git repo inside another Git repo
    • Known as nested repos

 

  • There will be two .git directories

  • Which .git directory should be updated?

 

Confused_dog

Introduction to Git

Let's practice!

Introduction to Git

Preparing Video For Download...