Introduction to Git (1)steemCreated with Sketch.

in #python-dev5 years ago

Git is a distributed version control system (DVCS).

Creating a New Repo

To work with Git, you first need to tell it who you are. You can set your username with the git config command:

$ git config --global user.name "your name goes here"

Once that is ste up, you will need a repo to work in. Creating a repo is simple. Use the git init command in a directory:

$ mkdir example
$ cd example
$ git init

Initialized empty Git repository in /home/jima/tmp/example/.git/
Once you have a repo, you can ask Git about it. The Git command you’ll use most frequently is git status. Try that now:

$ git status

On branch master

Initial commit

nothing to commit (create/copy files and use "git add" to track)
This shows you a couple of bits of information: which branch you’re on, master (we’ll talk about branches later), and that you have nothing to commit. This last part means that there are no files in this directory that Git doesn’t know about. That’s good, as we just created the directory.