Git

🌱 Welcome to the Git Section! Whether you’re learning version control for solo projects or preparing to collaborate with a team, this section will walk you through essential Git commands with hands-on examples. Structured around practical case studies, you’ll explore how to track changes, manage branches, and work with remote repositories—equipping you with the version control skills every programmer needs.

Installation

Please refer to the Data Science Setup to make sure you are up and running!

Summary Table

Summary of the Git section.

Create a Repository

Git Command Example Description
git clone git clone https://github.com/username/project.git Creates a local copy of a remote repository

Push and Pull

Git Command Example Description
git status git status Shows which files have been modified or staged
git add git add . Stages all changed files for commit
git commit git commit -m "message" Saves a snapshot of the staged changes
git push git push origin main Uploads your local commits to the remote repo
git pull git pull Downloads and merges changes from the remote repo

Branches

Command Example Description
git branch git branch Lists all local branches and shows the current one
git checkout -b git checkout -b feature-xyz Creates a new branch and switches to it
git push origin git push origin feature-xyz Pushes the branch to GitHub so others can access it
git checkout git checkout main Switches to the main branch
git merge git merge feature-xyz Merges changes from the feature branch into the current one
git branch -d git branch -d feature-xyz Deletes the local branch after it’s been merged