Setting up a new project

In this example, we'll be working with Chapter05/animal_farm/ from https://github.com/PacktPublishing/Mastering-Vim/tree/master/Chapter05/animal_farm. You can also follow along with any project you'd like. Follow these steps if you're setting up a new Git repository:

  1. Initialize the Git repository in the project's root directory:
$ cd animal_farm/
$ git init

2. Stage all files in a directory to be added to the initial commit:

$ git add .

3. Create an initial commit:

$ git commit -m "Initial commit"

Here's sample output from the previous commands:

You should now be ready to work with your newly created repository.

If you want to have your repository backed up somewhere outside of your machine, you may want to use a service such as GitHub. See github.com/new to create a new repository, and add the repository URL to your project (where https:// needs to be replaced with the repository URL— something like https://github.com/<your-username>/animal-farm.git):

$ git remote add origin <url>

Now, you just need to push the changes from your local repository:

$ git push -u origin master

To keep the repositories in sync, you'll have to push every time you add a new commit; see the Working with Git section for details. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.142.248