From the course: Building Your First CLI App in Node

The Git initialize process

From the course: Building Your First CLI App in Node

Start my 1-month free trial

The Git initialize process

- Git allows you to have version control in your projects, both locally and remote, with your own individual work and with teams. It's a core tool in the modern dev toolbox. Online Git hosts like GitHub and Bitbucket have allowed developer collaboration, as well as the open source community, to flourish. These days the first thing you probably do with any project is to create a Git repository for it. You can think of a Git repo as a box where you store a draft of your code on your local machine. Git init creates this box for you. If you've pushed a couple of projects through a remote code host, git init initializes, or starts the creation of, a Git repository in your current directory. To share it with others you will package your code and send a copy of it to an online storage, like GitHub or Bitbucket. When you stop to think about it though, that's not the only thing you need to do to get your project pushed online. Git init is only one of a number of steps involved in the process. Overall, the typical Git initialize process is made up of seven key steps. First, initialize the local repository. This is like creating an open box. We would use the git init command here. Second, create a remote repository, which is like getting an address label for your box. Third, add the remote repository to your project and this would be like sticking the address label on the box. Fourth, we'll create a .git ignore file and that lets your box know which files should not be added. Fifth, add the rest of your project files and this lets your box know which files should be added. Sixth, you want to commit your initial set of files, which is like closing and sealing the box and seven, you want to push the files to your remote repository, which is like sending the box. Every single time you push code to your remote repo, you're repeating these seven steps. There may be a few others you add to the workflow over time, but no matter what you're doing you must do these seven steps to complete a Git initialize process.

Contents