Lecturer: Michael Lydeamore
Department of Econometrics and Business Statistics
Last week most of us got stuck in Vi
mode
To fix this, run the following:
This will set either notepad or TextEdit to be your commit editor (much nicer).
On Mac, note you must quit (not just close the window) for the commit message to be complete.
Git works across three layers:
Some examples: - git add
moves changes → index - git commit
moves index → HEAD - git reset
moves HEAD pointer (soft/mixed/hard)
git revert
main
)git reset
--soft
: Keep changes staged--mixed
: Keep changes unstaged--hard
: Deletes changesYou’re now in detached HEAD!
If you want to keep changes made in detached HEAD:
✅ This creates a new branch from that point!
git commit --amend
Use this when you:
🎯 You can edit the message or leave it the same
⚠️ Avoid --amend
if you’ve already pushed the commit
git reflog
git reflog
to find the lost commitThen:
🎉 You’ve recovered “lost” work!
git rm
: Remove Files from the Repositorygit rm
to delete a tracked file from both your working directory and Git’s index.✅ After this commit, the file will no longer exist in your working directory or the repository.
git add
the deletion# After deleting manually:
git status # Shows deletion
git add filename.txt
git commit -m "Remove file"
✅ git rm
does both steps at once — it’s safer and cleaner
If you haven’t committed the deletion yet:
If you already committed the deletion:
✅ Or use git reflog
to find the commit where the file still existed
git rm --cached
: Keep the File, Remove It from Git✅ The file will still be on disk, but not in the next commit
You committed a large data file by accident
.gitignore
✅ Useful for cleaning up mistakes without losing the file
git clean
git clean
is permanentreflog
or reset-n
first to preview✅ Now those untracked files are gone!
Situation | Use This |
---|---|
Undo safely on shared branches | git revert |
Clean up your last commit | git commit --amend |
Rewind local commit history | git reset |
Accidentally reset or lost work | git reflog |
Delete untracked junk | git clean |
reset
?reflog
help you find that log
doesn’t?Squashing means combining multiple commits into a single one.
It’s useful for:
Squashing doesn’t change your code — just your history!
Before squashing:
If B, C, and D are all part of one logical change, we can squash:
✅ One clean commit — easier to read, review, and share.
Use interactive rebase to squash:
You’ll see:
Change to:
Then save + edit the commit message.
✅ Good times to squash:
❌ Avoid squashing:
\begin{document}
% Packages to be used
1\usepackage{amsmath}
2% Creating title
\title{This is an example}
\author{ETC5513, Monash University}
In order to be able to use LaTeX within our Quarto documents, we need to install tinytex
:
or
You don’t need the full LaTex installation for this unit, just this package.
There are different ways:
title: "Reproducible and Collaborative Practices"
subtitle: "Tutorial 7"
author: "Your Name"
institute: "Department of Econometrics and Business Statistics"
output:
pdf:
toc: true
toc_depth: 2
number_sections: true
highlight: tango
header-includes:
- \usepackage{titling}
- \pretitle{\begin{center} \includegraphics[width=5in,height=13in]{figs/front.jpg}\LARGE\\}
- \posttitle{\end{center}}
- \usepackage{fontawesome}
- \usepackage[most]{tcolorbox}
- \usepackage{xcolor}
- \usepackage{sectsty}
- \sectionfont{\color{olive}}
- \usepackage{verbatim}
There are different ways:
preamble.tex
LaTeX in 24 Hours A Practical Guide for Scientific Writing
Another way to include styling is to use a Quarto PDF extension. For example:
…and more here
These themes have the advantage of having done a lot of the LateX formatting for you. Looking inside the Quarto Monash memo, we have:
\pretitle{%
$if(branding)$%
\begin{textblock}{4}(1.9,0.85)\includegraphics[height=1.5cm]{monash2}\end{textblock}%
\begin{textblock}{4}(17.25,0.8)\includegraphics[height=1.5cm]{MBSPortrait}\end{textblock}%
\begin{textblock}{6}(13,28)\includegraphics[height=0.7cm]{AACSB}~~~
\includegraphics[height=0.7cm]{EQUIS}~~~
\includegraphics[height=0.7cm]{AMBA}
\end{textblock}
Which is doing a lot of positioning of pictures for the template.
Recap
amend
, revert
, and rm
ETC5513 Week 7