There’s a much better way than ctrl-z, a much better way.
Git gives you the ability to save your entire project’s history. You can create multiple versions of your project and return to any version at any time without losing any changes in any version.
Git also gives you the ability to collaborate with other developers much more easily. With Git, you can see who changed what file and easily resolve code conflicts.
You have to install Git on your computer before you can use it. If you have a Mac, there’s a great tool called homebrew that you can use to install git and another important packages (like node and npm). Git also recommends using homebrew.
Go to homebrew’s website. Copy the line of code and paste it into your terminal.
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”
After installing homebrew, just run one simple command to install git (instructions from git’s website).
https://git-scm.com/download/mac
brew install git
Now that you have git and other important libraries installed, you start versioning your projects.
Go to your project’s directory (in the terminal) and initiate a new git repo (repository). A git repo is where git stores all of its data to version your project.
cd ~/Code/appone
git init
Add all of the files to git and commit them to the current branch. A branch is one version of your project. All projects have a master branch.
git add .
git commit -m “My project’s first commit.”