
If your folder has report_final.xlsm, report_final2.xlsm and report_final_REAL.xlsm, you already understand why Git exists. It records every version of your files, who changed what, and lets you go back.
In this article
The four ideas
- Repository — a folder Git is tracking.
- Commit — a saved snapshot with a message (“Fix VAT rounding”).
- Branch — a parallel line of work, so experiments do not break the main version.
- Merge — bring a branch’s changes back.
First project
git init # start tracking this folder
git add . # stage all files
git commit -m "First version" # save a snapshot
git log --oneline # list snapshots
git checkout -b new-report # start a branch
# ...edit files...
git add . && git commit -m "Add region chart"
git checkout master # back to the main line
git merge new-report # bring the work in
Undo mistakes
git diff # what changed since the last commit
git checkout -- macros.bas # throw away edits to one file
git revert <commit-id> # undo an old commit safely
💡 Git works best with text: .bas/.cls VBA modules, SQL, Python and CSV. For .xlsx files it stores versions but cannot show line-by-line differences — export your VBA modules to .bas files and track those.
Put your repository on GitHub or GitLab for a free off-site backup and easy sharing.
✨ Ask AI about this article
Stuck on a step? Ask a question and the AI answers using this article.
Free · AI can be wrong