O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding files, committing, and pushing

Let's add a file to our repository, animals/lion.py:

"""A lion."""import animalclass Lion(animal.Animal):    def __init__(self):        self.kind = 'lion'    def get_kind(self):        return self.kind

Next let's add a bit to animal_farm.py that invokes the file (the added lines are highlighted in bold):

...from animals import dogfrom animals import lionfrom animals import sheep...    if kind == 'dog':        return dog.Dog()    if kind == 'lion':        return lion.Lion()    if kind == 'sheep':        return sheep.Sheep()...

You can check the status of your files (to see which changes are going to make it into a commit) by running the following command:

$ git status

The output of the command will show you that you swap animal_farm.py repository ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required