Mysore University School of EngineeringDepartment of AI & ML · BAIL308C Project Management with Git
Class 2 · Saturday, 21 November 2026
Git, on your own laptop.
Install it, make your first commit, then branch, merge and stash the way real teams do.
Abhishek Rai · Experiments 1, 2 and 3
Today · two hours
Six stops, one real project.
0:03
Recap
What we did on GitHub last week
0:08
Why Git
Save points, and Git vs GitHub
0:18
Install & set up
Git on every laptop, your identity
0:38
First commit
Three areas, init, add, commit
Experiment 1
1:12
Branches
Create, switch, merge
Experiment 2
1:34
Stash
Park unfinished work
Experiment 3
A five-minute break after the first commit. The last ten minutes: recap and your practical record.
A question first
Last Saturday, what did we do on GitHub?
Take two or three answers, then press next.
01 Recap
You already did a lot.
Switched a repo from public to private
What waited for today
No laptops last week, so Git itself waited until today.
Installing Git, git config, git init and your first commit.
01 Warm-up
Four questions from last week.
i.
Where do you make a repo private?
Settings, scroll to the Danger Zone, Change visibility.
ii.
What is README.md for?
The front page of your repo, written in Markdown.
iii.
Public vs private: who can see each?
Public: anyone on the internet. Private: only you and people you invite.
iv.
After editing or deleting a file on GitHub, which button did you press last?
Commit changes
02 Sound familiar?
One report. Six copies. Which one is real?
Everyone has made this folder. Nobody ever taught us a better way.
Git keeps one file, with its whole history inside it.
report.docx
report_final.docxdelete
report_final2.docxdelete
report_FINAL_final.docxdelete
report_USE_THIS.docxdelete
report_v3_NEW.docxdelete
02 The one big idea
A commit is a save point in a game.
Break something later? You do not restart the level. You load the last save.
load the last save
02 Why this is worth two hours
9 in 10
developers use Git.
Stack Overflow Developer Survey, 2022. The default for version control in almost every software job.
Born in
2005
Linus Torvalds wrote Git to manage the Linux kernel, which today has over a million commits from thousands of people.
Internship and job posts list Git and GitHub as a basic skill.
02 The mix-up everyone makes
Git is not GitHub.
The engine
Git
Software on your laptop.
- Tracks every change and saves history
- Works fully offline
- Today we install it
Wi-Fi
Wi-Fi off, still committing
The garage
GitHub
A website that parks your project online.
- Backup and sharing
- Teamwork: reviews and issues
- What we used last week
03 Laptops open
Install Git.
Windows
Go to git-scm.com and click Download for Windows. Run it and press Next, with care on three screens. Then open Git Bash.
macOS
Open Terminal and type git --version. If asked, click Install for the Command Line Tools.
Linux
sudo apt install git on Ubuntu or Debian, sudo dnf install git on Fedora.
$ git --version
git version 2.51.0
03 Windows only
Press Next, except on these three screens.
Git Setup
Git Setup
Press next to walk through the three screens that matter.
Choosing the default editor used by Git
Git opens this editor when it needs you to type a message.
Use Vim (the default)
Use Notepad as Git's default editor
Use Visual Studio Code (if installed)
Next
Adjusting the name of the initial branch
The first branch in every new repository.
Let Git decide
Override the default branch name
Leave it. We set it to master ourselves shortly.
Next
Adjusting your PATH environment
Where you can use Git from.
Use Git from Git Bash only
Git from the command line and also from 3rd-party software (Recommended)
Use Git and optional Unix tools…
Next
i
Default editor: Notepad
Vim confuses beginners. Notepad is easy to close.
ii
Branch name: Let Git decide
We set it with git config.
iii
PATH: Recommended
Already selected. Press Next.
Every other screen: leave it, press Next, then Install.
03 Did it work?
Open Git Bash. Type this.
Git Bash
git --version
git version 2.51.0.windows.1
any 2.x number is fine
“command not found”?
Close the window and open a new one. A fresh terminal picks up the new install.
Mac and Linux: use Terminal. The version line looks slightly different; that is fine.
03 Never used a terminal?
Five commands to get around.
| pwd | Where am I? |
| ls | What is in this folder? |
| mkdir name | Make a new folder |
| cd name | Go into a folder |
| cd .. | Go back up one level |
Try it
pwd
/c/Users/student
ls
Desktop Documents Downloads
cd Desktop
pwd
/c/Users/student/Desktop
Tip: press Tab to auto-complete a folder name.
03 Once per laptop
Tell Git who you are.
Git Bash
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch master
git config --list
user.name=Your Name
user.email=you@example.com
init.defaultbranch=master
Name & email
Stamped on every commit. Use the email from your GitHub account.
defaultBranch
Names your first branch master, as in the syllabus and the exam.
04 The idea everything builds on
Three rooms every change walks through.
Room one
Working Directory
your messy desk
The files you see and edit.
Room two
Staging Area
the bag you pack
Changes chosen for the next commit.
Room three
Repository
the sealed vault
Permanent history in .git
git add
git commit
notes.txt untrackedstagedcommitted
04 Experiment 1 · type along
Turn a folder into a repository.
~/Desktop
mkdir my-first-project
cd my-first-project
git init
Initialized empty Git repository in
.../my-first-project/.git/
git status
On branch master
No commits yet
nothing to commit
my-first-project
.githidden folder
this is the whole history
04 Experiment 1 · type along
Make your first commit.
~/Desktop/my-first-project (master)
echo "Hello Git" > notes.txt
git status
Untracked files:
notes.txt
git add notes.txt
git status
Changes to be committed:
new file: notes.txt
git commit -m "Add initial notes file"
[master (root-commit) 92d4b40] Add initial notes file
1 file changed, 1 insertion(+)
Red
Git sees the file but is not tracking it yet.
Green
Staged. In the bag, ready to commit.
Committed
92d4b40 is this save point's ID. Yours will be different.
04 Read the history
git log shows every save point.
my-first-project (master)
git log
commit 92d4b40a57bf0423612a21e302b72a6ee8df497e
Author: Ada Lovelace <ada@example.com>
Date: Sat Nov 21 10:15:00 2026 +0530
Add initial notes file
git log --oneline
92d4b40 Add initial notes file
| commit | the ID, a long hash |
| Author | from your git config |
| Date | when you committed |
| Message | what changed |
Long log and the prompt vanished? Press q to get back.
04 Your turn · five minutes
Make a second commit, on your own.
1
Create todo.txt with one line
echo "Buy milk" > todo.txt
3
Commit with a real message
git commit -m "Add todo list"
4
Check: two commits?
git log --oneline
Commit messages
| Weak | "update" |
| Weak | "final fix" |
| Clear | "Add todo list" |
Say what changed. Future you will thank you.
04 Everyone hits these
Three things that look scary, and are not.
1
A strange editor opened
You forgot -m. If it is Vim (full screen, no menus), quit with:
Esc:q!Enter
In Notepad: type a message on line 1, save, close.
2
A warning about LF and CRLF
warning: LF will be replaced by CRLF
Normal on Windows; it ends lines differently. Ignore it, your command worked.
3
“Please tell me who you are”
*** Please tell me who you are.
Git has no name or email yet. Run the two git config --global lines, then commit again.
Break
Stretch. Water. Back in five.
Keep your terminal open in my-first-project. We use it next.
Think about it
Five of you build one app, all editing master at the same time. What happens?
Take a guess, then press next.
05 Experiment 2
A branch is a safe copy to experiment in.
You want a new kitchen, so you build a full-size mock-up in the garage first. Only when it works do you bring it into the house.
| master | the real house, always working |
| feature-branch | the mock-up, try anything |
05 All you need
Four commands to branch.
| Command | What it does |
| git branch feature-branch | Creates a branch. You do not move onto it. |
| git checkout feature-branch | Moves you onto that branch. git switch also works. |
| git branch | Lists branches. * marks the one you are on. |
| git merge feature-branch | Brings that branch's commits into the branch you are on. |
05 Experiment 2 · one step per press
Branch, commit, merge.
my-first-project
(press next for step 1)
git branch feature-branch
git branch
feature-branch
* master
git checkout feature-branch
Switched to branch 'feature-branch'
echo "Login page" > login.txt
git add login.txt
git commit -m "Add login page"
[feature-branch 4bd50f7] Add login page
git checkout master
Switched to branch 'master'
git merge feature-branch
Updating 30755db..4bd50f7
Fast-forward
your last commit
4bd50f7Add login page
master
feature-branch
HEAD
fast-forward
login.txt gone? It is safe on the branch.
Files in your folder
notes.txt
todo.txt
login.txt
05 Not every merge is a fast-forward
Three ways a merge can go.
Fast-forward
Just slide forward
Master did not move. Git moves the label. No new commit.
Three-way merge
Both moved
Different parts changed. Git makes a new merge commit joining both.
Conflict
Same lines changed
Git will not guess. It pauses and asks you to choose.
05 When Git asks you to choose
A conflict is not a crisis.
<<<<<<< HEAD
Welcome to our app!
=======
Hello and welcome, friend!
>>>>>>> feature-branch
1
Open the file
Find the <<< === >>> markers.
2
Keep the right text
Delete the other version and all three marker lines.
3
Stage and commit
git add the file, then git commit.
Blue is where you are (HEAD). Pink is the branch coming in.
Picture this
Half-way through editing, your teammate says: it is broken, fix it now.
You are not ready to commit. What do you do?
06 Experiment 3
Stash is a drawer for unfinished work.
switching with unfinished changes
git checkout other-branch
error: Your local changes to the following files
would be overwritten by checkout:
notes.txt
Please commit your changes or stash them
Git may refuse to switch with work in progress.
git stash puts it in a drawer, clears your desk, and lets you switch. Later you take it back out.
06 Experiment 3 · one step per press
Stash, switch, pop.
my-first-project (master)
(press next for step 1)
git branch other-branch
echo "Half-finished idea" >> notes.txt
git status --short
M notes.txt
git stash
Saved working directory and index state WIP on master
git stash list
stash@{0}: WIP on master: 4bd50f7 Add login page
git checkout other-branch
...the urgent fix happens here...
git checkout master
git stash pop
modified: notes.txt
Dropped refs/stash@{0} (90db412...)
notes.txt
Hello GitHalf-finished idea
06 The stash family
Four stash commands.
| Command | What it does |
| git stash | Put unfinished changes in the drawer. Desk is clean. |
| git stash list | See everything in the drawer. |
| git stash pop | Take the newest one back out and remove it from the drawer. |
| git stash apply | Bring it back but keep a copy in the drawer. |
07 Recap · I pick who answers
Six questions. Hands down.
i.
What does git init create?
A hidden .git folder. That is the repository.
ii.
Git vs GitHub, in one line?
Git tracks history on your laptop. GitHub hosts it online.
iii.
What is the staging area for?
Choosing exactly which changes go in the next commit.
iv.
Why branch instead of editing master?
Master stays working while you experiment safely.
v.
What does Fast-forward mean?
Master had not moved, so Git just slid its label forward.
vi.
What does stash solve?
Switching branches without committing unfinished work.
07 Before next class
Write up Experiments 1, 2 and 3.
Experiment 1
Setting up and basic commands
init, add, commit with a message.
Aim · Commands · Output · Result
Experiment 2
Create and merge a branch
branch, checkout, commit on the branch, merge into master.
Aim · Commands · Output · Result
Experiment 3
Stash
stash, switch branches, come back, stash pop.
Aim · Commands · Output · Result
Write the exact commands you typed and what the terminal printed. Each experiment is marked out of 10.
07 Next class
Your laptop meets your GitHub repo.
We download the repository you made in Class 1 onto your laptop, and keep the two in sync. Experiments 4, 5 and 6.
git clonegit fetchgit rebasemerge --no-ff
BAIL308C · Class 2
You made real commits.
Practise at home: flashcards, quiz, cheat sheet, and these slides.
git-github-by-abhirai2006.netlify.app
Questions? Ask now, or catch me after class.