AGENDA¶
- What is Git?
- History and motivation
- Key concepts: repo, commit, branch, remote
- First Git commands
- Working with remotes (GitHub/GitLab)
- Mini exercises
What is Git?¶
- A distributed version control system (VCS)
- Tracks changes in files (mostly source code)
- Allows collaboration, history, and backups
- Invented by Linus Torvalds in 2005 for Linux kernel
- The name? British slang for "unpleasant person" – Linus being ironic

Why Git?¶
- No more "final_v2_neu.cpp"
- History of every change
- Work in parallel on different features
- Collaboration across teams
- Safe backups
Git Concepts¶
- Repository (repo): project folder + .git directory
- Commit: snapshot of changes
- Branch: parallel line of development
- Remote: server version (GitHub, GitLab)
- Clone: copy remote repo locally
Prerequisites¶
git config --global user.name "Charlie Smith"
git config --global user.email "charlie.smith@powerplant.com"
Create a New Repo¶
Make sure to have a new empty folder (directory).
git init
git status
echo "Hello Git" > README.md
git add README.md
git commit -m "Initial commit"
Tracking Changes¶
git status # show modified files
git diff # show changes
git add file.cpp # stage changes
git commit -m "Describe your change"
Working with Remotes¶
- Connect local repo to a server (GitHub/GitLab)
git remote add origin <url>
git push -u origin main
git pull origin main
git clone <url>
.gitignore¶
- Tell Git which files NOT to track
Example
.gitignore:
*.o
*.log
build/
Viewing History¶
git log
git log --oneline --graph
Mini-Exercises¶
Exercise 1¶
- Create a new folder and initialize a Git repo
- Add a file
hello.txtand commit it - Edit
hello.txtand commit the change - Inspect history with
git log
Exercise 2¶
- Clone an existing repository from Github
git clone https://github.com/breiting/dtle-2025
Exercise 3 (requires a Github account)¶
- Create a new repo on GitHub
- Link your local repo with remote (
git remote add origin ...) - Push your commits to GitHub
- Clone the repo into a new directory to verify
Survival Package (Git Basics)¶
git initgit statusgit addgit commit -mgit loggit diffgit remote add origingit pushgit pullgit clone- Don't forget to add a
.gitignorefile
Wrap-Up¶
- Learned what Git is and why it matters
- Created first local repo
- Connected to a remote repo
- Practiced committing and pushing
Resources¶
Next Session¶
- Advanced Git: branching, merging, conflicts
- Stash and blame