Learning Git (1)

From Wiki @ Karl Jones dot com
(Redirected from Learning git (1))
Jump to: navigation, search

This article introduces Git for the beginner.

Requirements

Learning and using Git requires:

Git hosting services

See GitHub.

Git clients

See Git client and GitHub Desktop.

Git servers

See Git server.

Command line

Getting a git repository

You can get a Git project using two main approaches.

  • The first takes an existing project or directory and imports it into Git.
  • The second clones an existing Git repository from another server.

Initializing a Repository in an Existing Directory

If you’re starting to track an existing project in Git, you need to go to the project’s directory and type:

$ git init

This creates a new subdirectory named .git that contains all of your necessary repository files – a Git repository skeleton.

At this point, nothing in your project is tracked yet. (See Git Internals for more information about exactly what files are contained in the .git directory you just created.)

If you want to start version-controlling existing files (as opposed to an empty directory), you should probably begin tracking those files and do an initial commit. You can accomplish that with a few git add commands that specify the files you want to track, followed by a git commit:

$ git add *.c
$ git add LICENSE
$ git commit -m 'initial project version'

Source: https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository

Typical process

Terminology

See also

External links

GitHub links:

General links:

June 06, 2013

Videos:

Bonus video: