Git

Note: The Gentoo git repos for developers can be found here: https://gitweb.gentoo.org/

Git is distributed revision control and source code management software. The goal of this article is to easily get a Git repository up and running.

Git was developed by Linus Torvalds for use on the Linux Kernel and other open source projects. According to a talk he gave for Google, he was searching for a Source Control Management (SCM) and used three criteria.

SCM must:
 * 1) Be distributed;
 * 2) Be fast;
 * 3) Output exactly what was put in, or an error should be printed.

Since there were no satisfactory options Linus wrote Git.

Emerge
Install :

Configuration
Before contributing to a project it is imperative to establish a user name and email for each user. Substitute the bracketed Larry references (brackets and everything in-between, but leave the quotes) in the next example for a personal user name and e-mail address:

Local
If you're the only one using your project, or if you're creating something which will be shared in a distributed way, then you should start on your workstation. If you intend to have a central server which everyone uses as the "official" server (e.g. GitHub) then it might be easier to create an empty repository there.

The next list of commands will describe how to create a repository on a workstation:

You're done. You've created a local repository. It's in the folder, so don't delete your  folder unless you mean to lose everything.

Now, let's say we make some edits:

The new file must be added (staged) before it can be included in the git repository. Use the next commands to stage the file and to make the commit:

Server
In this section will cover setting up a Git server for remote project management through SSH.

If not sure then skip this section.

Initial setup
Start by creating the needed group, user, and home directory. The user uses the  to prevent normal shell access.

Edit to change user from "nobody" to "git" and start the daemon.

SSH Keys
SSH is the preferred method to handle the secure communications between client and server. For Git to work properly, you must have private/public key logins enabled and all client public keys added to. For more information and instructions on how to enable, create, and share keys, please see the SSH - Passwordless Authentication wiki page.

Create a repository and make the initial commit
On the server:

Become user  to make sure all objects are owned by this user:

Create a bare repository:

On a the client station:

Common Commands
Clone a repository:

Repository management via GUI
Git ships with a tk GUI. Invoke it using:

Serving and managing repositories via builtin web interface
Git comes with a builtin web interface,. It can run on different web servers, for example lighttpd (no configuration necessary), Apache (some configuration necessary) or nginx. In order to use, you need to install one of those three servers and enable the   USE flag for.

There is a simple setup script that will create a working default configuration, start a webserver (default ) and open the URL in a browser:

Find out more about the options in the builtin help:

If  opens a 404 error, enable the   USE flag and rebuild.

External resources

 * Video tutorials: http://try.github.io/levels/1/challenges/1
 * Free, good, basic first-time tutorial: https://www.codeschool.com/courses/git-real
 * git flow documentation, client side scripts to make git repository management a snap.
 * The Official Git Handbook