What is Git?
Git remembers every saved version of a folder. Repository, commit, and the four first commands: git status, add, commit and log.
Try it
- Git timeline – A pretend Git: edit files, then git add, git commit, git status and git log, and undo an edit.
Transcript
When you work on a project, you want to be able to go back to an earlier version. Git is a tool that remembers every saved version of your folder. The folder it watches is called a repository.
Each saved version is called a commit. A commit is a snapshot of your files, with a short message that says what you changed. It is like a checkpoint in a game.
To make a commit you use three commands. Git status shows what changed. Git add chooses the changes to save. Git commit saves them, with a message.
Git log lists all the commits, newest first. If something breaks, you can go back to a commit that worked. Git never saves by itself: you decide when to make a checkpoint.
Remember: Git remembers versions. A repository is the folder it watches, a commit is one saved version, and git status, add, commit and log are the commands to start.
More in this series
1:2425The DOM
The DOM is the tree of nodes the browser builds from your HTML. Find a node with document.querySelector and change it with textContent.
1:1926Events in the browser
An event is something that happens on the page. addEventListener waits for it and runs a handler function, shown next to the same idea in Scratch.
1:1827Changing the page
Toggle a class with classList so CSS restyles an element, and build new elements with createElement and append, like a to-do list adding tasks.
1:1528Arrays and objects
An array is a numbered list, an object is a set of labelled values. An array of objects and a loop turn data into cards.
1:2429Local storage and JSON
localStorage is the browser's notebook for your site. JSON.stringify turns an array or object into text to save, and JSON.parse turns it back.
1:2630Fetch and JSON
The browser is the client and fetch sends the request. The server answers with JSON, async and await wait for it, and the Network tab shows what happened.
1:1631Debugging JavaScript
Find bugs in JavaScript: console.log to look, reading an error message and its line, and a breakpoint to pause and step through code in DevTools.