DEV Community

PETER AMORO
PETER AMORO

Posted on

Learning Git & GitHub as a Data Engineering Student at LuxDevHQ

As a student who recently started learning Data Engineering, one of the first tools we were introduced to was Git and GitHub it is one of the most important tools for anyone working with code and data and planning to collaborate with my fellow students at LuxDevHQ

This article explains in a simple way:

  • What Git and GitHub are
  • How to set up Git Bash
  • How to connect Git to GitHub
  • How to push and pull code
  • How version control works

What is Git?

Git is a version control system.

It helps you keep track of every change you make to your files and keep track of each version of your code.

This is very important in Data Engineering because we:

  • Experiment with data
  • Change code often
  • Work on long projects

Git makes sure nothing gets lost.


What is GitHub?

GitHub is a website where Git projects are stored online.

It allows you to:

  • Back up your work
  • Share your projects
  • Work with other people
  • Show your work to employers

Git works on your computer.

GitHub stores your Git projects on the internet.


Installing Git Bash

For my case, i use a macbook so i dont install Git Bash natively so i install git via the terminal.

On macOS

Open Terminal and type

git --version



![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sjljwj0u29l9t7jhenq8.png)



# Connecting to a GitHub Account

## Step 1: Login or Create a GitHub account., since i have an account i just login 



## Step 2: Configure Git with your details

Run the following commands:

Enter fullscreen mode Exit fullscreen mode


bash
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"


Confirm the setup:

Enter fullscreen mode Exit fullscreen mode


bash
git config --list


![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oisj0pdxrst6raqbw6zp.png)


# Connecting Git to GitHub Using SSH

Using **SSH** allows you to push and pull code **without entering your password every time**.

## Generate an SSH key

Enter fullscreen mode Exit fullscreen mode


bash
ssh-keygen -t ed25519 -C "youremail@example.com"


Press **Enter** for all prompts.

## Start the SSH agent and add the key

Enter fullscreen mode Exit fullscreen mode


bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519


## Copy the SSH key

Enter fullscreen mode Exit fullscreen mode


bash
pbcopy < ~/.ssh/id_ed25519.pub


## Add the SSH key to GitHub

1. Go to **GitHub Settings**
2. Select **SSH and GPG keys**
3. Click **New SSH key**
4. Paste the key and save

Test the connection:

Enter fullscreen mode Exit fullscreen mode


bash
ssh -T git@github.com


A success message confirms the connection.

![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fk86o2r75v3b6cizf9db.png)


# Understanding Version Control

**Version control** is a system that:

* Tracks **file changes**
* Saves a **history of your project**
* Allows you to **restore previous versions**
* Enables **safe collaboration**

Git works like a **timeline**, recording every meaningful change.

# Creating a Local Git Repository

## Create a project folder

Enter fullscreen mode Exit fullscreen mode


bash
mkdir luxDev
cd luxdev





## Initialize Git

Enter fullscreen mode Exit fullscreen mode


bash
git init

![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j7iait5xdeax62en3tbo.png)

Git now tracks this folder.

# Tracking Changes with Git

## Check file status

Enter fullscreen mode Exit fullscreen mode


bash
git status


![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ibpj5heslws8dfe5rzol.png)



## Add files to the staging area

Enter fullscreen mode Exit fullscreen mode


bash
git add .


## Commit changes

Enter fullscreen mode Exit fullscreen mode


bash
git commit -m "Initial commit"


A **commit** is a saved snapshot of your project.

# Pushing Code to GitHub

## Create a repository on GitHub

* Click **New Repository**
* Do **not** add a README file
* Copy the **SSH repository link**

![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fb673jj5ont71p5lhrsi.png)


## Connect the local project to GitHub

Enter fullscreen mode Exit fullscreen mode


bash
git remote add origin git@github.com:username/repository-name.git


## Push code to GitHub

Enter fullscreen mode Exit fullscreen mode


bash
git branch -M main
git push -u origin main


Your code is now available on **GitHub**.

# Pulling Code from GitHub

To download updates from GitHub:

Enter fullscreen mode Exit fullscreen mode


bash
git pull origin main


This is useful when:

* Working on **multiple devices**
* Collaborating with **other developers**
* Updating **shared projects**

# Viewing Project History

Enter fullscreen mode Exit fullscreen mode


bash
git log




This command shows **previous commits**, authors, and dates.




Enter fullscreen mode Exit fullscreen mode

Top comments (0)