Lessons · Vi Studio · 29 of 36
Source Control (Git)
Commits, diffs and publishing to GitHub.
Git keeps a history of your project: every commit is a saved snapshot you can look back at, and GitHub keeps a copy online. Open Source Control with the branch icon just above the Assistant's sparkle, or Ctrl+Shift+G. A blue number on the icon counts the files you changed.
Start
- Initialize Repository turns the project folder into a Git repository. Studio also writes a
.gitignore, so generated files (.vi/,node_modules/) stay out of the history. - No Git on this PC? The view offers Download Git (about 50 MB, into Vi Studio's own folder; nothing else on your PC changes). On a Mac it shows the one command that installs it.
Changes and commits
- Changes lists every file you changed since the last commit: M changed, A added, D deleted, U new and not tracked yet. Click one to see a side-by-side diff: old on the left, new on the right.
- + stages a file (puts it in the next commit); − takes it back out. Stage All stages everything.
- Type a message that says what you did ("Add a delete button to tasks") and press Commit (or Ctrl+Enter). With nothing staged, Studio offers to commit every change.
- The first time, Studio asks for your name and email. They are written into each commit.
- Discard throws a change away and goes back to the last commit. Studio always asks first, and new files go to the Recycle Bin, not straight into oblivion.
GitHub
- Publish to GitHub opens github.com in your browser with a new repository already named after your project. Create it, copy its address, paste it into Studio, and Studio pushes your commits. The first push asks you to sign in to GitHub in a browser window.
- After that, Sync sends your new commits up and brings other people's down. The numbers next to it show how many commits are waiting each way.
- The branch name sits in the status bar. Click it to switch to another branch or create one.
Recent Commits at the bottom of the view lists the last 30 snapshots.
Every example here runs in Vi Studio: open it in your browser (phones too) and press Start learning on the welcome page. Each code block there has a Try it button that runs it in the phone preview.
More in Vi Studio
- Inspect, move and lay outFind a container’s code, drag it somewhere else, set its layout.
- Build for Android and iOSStore builds and test builds in Expo’s cloud.
- The AssistantA local AI helper that proposes edits you can apply.
About Vi. Vi is a free, open-source programming language for building real mobile apps. You describe each screen in plain words, and Vi compiles it to React Native (Expo) for Android, iOS and the web. Its editor, Vi Studio, runs on Windows, in any browser and on your phone, with the app running live as you type. Read more about Vi.