Git for Beginners, With an AI Assistant Beside You

Git is a tool that records snapshots of your project folder, so you can see what changed and go back to an earlier snapshot if something breaks. For a beginner building with an AI assistant, you need only a handful of commands: one to start tracking a folder, one to save a snapshot, one to look at history and one to undo a bad change. An assistant can explain each command before you run it.
You do not have to use Git. Numbered copies of your files work for small projects. Git becomes worth learning when you edit often, want a clear history, or plan to publish through a service that uses repositories.
What Git actually does
A Git repository is your project folder plus a hidden record of its history. Each time you save a snapshot, called a commit, Git stores the state of your files along with a short message you write. Later you can look at the list of commits, compare two of them, or restore a file from an earlier one.
Think of it as an unlimited undo button that you control. The key difference from ordinary saving is that you choose the moments to record and describe them.
Install and set up
Git is a free program available for Windows, Mac and Linux. Download it from the official Git website and follow the installer’s defaults. Many computers already have it, which you can check by opening a terminal and typing git --version.
Then tell Git who you are, once, so your commits carry a name and email:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Use an email address you are comfortable having attached to your commits, since it can become visible if you publish the repository.
The five commands you need
Open a terminal in your project folder and use these:
git initstarts tracking the folder. You run it once.git statusshows which files changed since the last snapshot.git add .selects all changed files for the next snapshot.git commit -m "Add reset button"saves the snapshot with a message.git log --onelinelists your snapshots, newest first.
The routine after each successful change is: check status, add, commit with a clear message. Make commits small and frequent, one per working change, not one huge commit at the end of the week.
Going back
To see what changed in a file, use git diff. To discard changes you have not committed and return a file to its last saved state, use git restore filename. This permanently throws away the unsaved edits, so make sure you really want that.
To go back further, ask your assistant to explain the options before you act: “I want to return my project to the state of an earlier commit without losing the history. What are my safe choices, and what does each command do?” Some commands rewrite history or delete work, and it is worth understanding them first.
Let the assistant explain, but check what it tells you
An assistant is good at explaining Git, because the commands are well documented. Use it to translate error messages and to preview what a command will do. Good questions include “What will this command change?” and “Can I undo it afterward?”
Be careful with commands that include words like force, reset --hard or clean. They can delete work. Do not run them unless you understand the effect, and consider making a copy of the folder first. If an assistant suggests one, ask for the safer alternative.
Use it with GitHub and similar sites
Git works entirely on your computer. Sites such as GitHub add a remote copy online, which serves as a backup and as a way to publish with services like GitHub Pages. To connect, you create a repository on the site, link it to your local folder with a command it shows you, and send your commits with git push.
Keep secrets out. Never commit passwords, API keys or private files, because they stay in the history even if you delete them later. Add a file named .gitignore listing files Git should skip, and ask your assistant to create one for your project.
Good habits
- Write messages that say what changed: “Fix rounding in per-person total” beats “update.”
- Commit only when the project works.
- Check
git statusbefore committing so you know what is included. - Keep unrelated changes in separate commits.
- Do not store large files, such as videos, in the repository.
Common first problems
If a command says it is not a git repository, you are in the wrong folder or you have not run git init. If Git complains about identity, set your name and email. If you are confused by a message, copy it exactly and ask the assistant, just as you would with a code error.
A short practice session
Try this in a scratch folder before using Git on anything important. Create a text file with one line. Run git init, then git add . and git commit -m "first version". Edit the file, run git status and read what it says, then git diff to see the change. Commit again with a new message. Finally run git log --oneline and see both commits listed.
Now break something on purpose: delete the file’s contents, save, and run git restore on it to bring the last saved version back. Watching that work builds trust in the tool. After ten minutes, the commands stop feeling foreign, and you can use them on a real project with much more confidence.
Next steps
Install Git, set your name and email, and run git init in a practice folder with a single text file. Make three commits with small edits, look at git log --oneline, and restore an earlier version of the file. Once that feels comfortable, use Git in your real project, and record the commands you use most in your notes file.