Your first repository, step by step
Create a repository, save versions, look at history, and undo mistakes, with every idea explained.
Search for a command to run…
Create a repository, save versions, look at history, and undo mistakes, with every idea explained.
This guide builds a small project from scratch. Along the way you'll learn the four ideas everything else in zev is built on: the working folder, the staging area, commits, and history.
If you haven't installed zev yet, start with Installation.
mkdir notescd noteszev initInitialized empty Zev repository in ./.zev/A repository (or repo) is a folder whose history zev keeps. All of that history lives in the hidden .zev folder. Don't edit it by hand; if you delete it, the folder becomes a normal folder again and the history is gone.
Set your name and email once per project. They go on every commit you make:
zev config set user.name "Sara Ahmadi"zev config set user.email "sara@example.com"It helps to picture three places:
| Place | What it is | How things get there |
|---|---|---|
| Working folder | Your files, as you see them in your editor | You edit them |
| Staging area | The changes you've picked for the next commit | zev add |
| History | Every commit you've made, saved for good | zev commit |
Nothing reaches history by accident. You choose what to stage, and then you commit it.
Create two files:
echo "Buy milk" > todo.txtecho "Ideas for the project" > ideas.txtAsk zev what it sees:
zev statusOn branch mainUntracked files: (zev add <file> to start tracking; list in .zevignore to hide) ideas.txt todo.txtUntracked means zev sees the files but isn't keeping their history yet. Stage both and commit:
zev add .zev commit -m "Start my notes" added ideas.txt added todo.txtStaged 2 change(s). Next: zev commit -m "what you changed"Created commit: 5f7f5e226bb19014179575681efba0f8be95eb6a8e64c1fc7dbc6f4d68224d01Committed 2 file(s)That long string is the commit's ID. It is a fingerprint (a hash) of everything in the commit, so it can never be confused with another commit. You only ever need to type its first few characters, for example 5f7f5e22.
Good commit messages say what changed and why, in a few words: "Fix login when the password has spaces" is much more useful later than "fix".
Change one file and add a new one:
echo "Buy bread" >> todo.txtecho "Call Ali" > calls.txtzev statusOn branch mainChanges not staged for commit: (zev add <file> to include them; zev restore <file> to throw them away) modified: todo.txtUntracked files: (zev add <file> to start tracking; list in .zevignore to hide) calls.txtSee the changed lines:
zev diffmodified: todo.txt@@ -1,1 +1,2 @@ Buy milk+Buy bread+ is a line that was added and - a line that was removed. The @@ -1,1 +1,2 @@ line tells you where in the file the change is: old file from line 1 (1 line), new file from line 1 (2 lines). You can ignore it at first.
Now commit only todo.txt, and leave calls.txt for later:
zev add todo.txtzev diff --stagedzev commit -m "Add bread to the list"zev diff --staged shows exactly what the next commit will contain. It's a good habit to check it before committing.
zev logcommit 8a41c2d0…Author: Sara Ahmadi <sara@example.com>Date: 2026-10-04 09:25 UTC Add bread to the listcommit 5f7f5e22…Author: Sara Ahmadi <sara@example.com>Date: 2026-10-04 09:20 UTC Start my notesThe newest commit is on top. A shorter view, one line per commit:
zev log --onelineTo see one commit and exactly what it changed:
zev show 5f7f5e22 # by the start of its IDzev show HEAD # the newest commitzev show HEAD~1 # the one before itHEAD means "the commit you're on now". HEAD~1 is one before it, HEAD~2 two before, and so on.
Everyone makes mistakes. Here's how to get out of the common ones.
Throw away changes you haven't staged (go back to the last commit's version of a file):
zev restore todo.txtBe careful: the changes you throw away are gone for good, because they were never committed.
Unstage a file (keep your edits, but take the file out of the next commit):
zev restore --staged todo.txtPut changes aside for a moment (for example, to look at something else with a clean folder):
zev stashzev stash pop # bring them backBring back a file you deleted by mistake (if it was committed before):
zev restore calls.txtMore situations, such as deleting and renaming files, are in How do I…?.
To delete a file and record that in the next commit:
zev rm ideas.txtzev commit -m "Remove ideas"Deleting the file any other way works too. Then zev add ideas.txt (or zev add .) stages the deletion.
To rename, rename the file normally and stage both names:
mv calls.txt phone.txtzev add calls.txt phone.txtzev commit -m "Rename calls to phone"Build output, logs and secrets don't belong in history. List them in a file called .zevignore in the top folder of the project:
# .zevignorenode_modules/build/*.log.envIgnored files don't show up in zev status, and zev add . skips them. Commit .zevignore itself so everyone working on the project ignores the same files.