Using Git
- Please check the Git documentation (available at http://git-scm.com/documentation) for a thorough understanding of Git. However, let's see some basic commands on how to use Git (I assume that you have Git installed on your machine). The first step in setting up Git is to create a local folder where you'll be saving your work. So let's say you are writing a book on Angular and you want to show an example of Angular code to your readers, and you decide that you'll keep all the source code examples in a folder called
C:\book-examples
. - So let's open the Git bash on Windows (in the folder
C:\book-examples
), or on Ubuntu you can open a terminal and type the following command:$ git init
Once you do that, you'll notice that there is a .git
folder in your C:\book-examples
folder:

An empty Git repository
Now look at your terminal and it shows you the name of the Git branch as shown in the following screenshot:

Git Bash showing the current branch of a Git repository...