Autore Sottoscrivi questo autore
Avatar utente
Articoli: 75
Iscritto il: 11 gen 2009, 21:14
Località: Bari
Sito Web:
Cerca articoli

Opzioni segnalibri
Segnalibri social networks disponibili:
Blogger Delicious Digg Facebook Feed amici Google Link in Live Mixx MySpace Netvibes Reddit Stumbleupon Technorati Twitter Wordpress
Vota questo articolo

Questo articolo è valutato 3
con 0 voti espressi.
Esporta articolo

[FAQ] Guida in inglese Git software per repository

ID Articolo: 78
Scritto da: Lucky
Scritto il: 9 apr 2011, 16:56
Descrizione articolo: Ideale per chi vuole creare revisioni di codice o collaborare con traduzioni. E' il prodotto consigliato dallo Staff di
Link esterno a questo articolo:

Guida in inglese per utilizzare Git software simile a SVN Toirtoise che si occupa delle revisioni, la guida mi è stato fornita da Erik Frèrejean Support Team Member di con il quale stò collaborando per diverse traduzioni italiane di mod per phpBB.

Erik Frèrejean ha scritto:Hi,

I've dug this up from a translators guide used here, should explain everything you need. If you've got additional I'd suggest that you join the [c]#phpbb-coding[/c] IRC channel on (

Maël Soucaze ha scritto:This documentation will explain the commands needed to compose and commit snapshots of your translation(s). It still needs to be improved and will be ; in the coming days/months.

  • [goto=setup]Setup[/goto]
    • [goto=signup_free_github_account]Signup for a free GitHub account[/goto]
    • [goto=download_install_git_machine]Download and install Git on your machine[/goto]
    • [goto=generating_ssh_keys]Generating SSH keys[/goto]
    • [goto=setup_username_email]Setup username and e-mail[/goto]
    • [goto=setup_line_ending_preferences]Setup line ending preferences[/goto]
  • [goto=starting]Starting[/goto]
    • [goto=forking_repository]Forking a repository[/goto]
    • [goto=cloning_fork_locally]Cloning the fork locally[/goto]
    • [goto=create_branch]Create a branch[/goto]
    • [goto=basic_snapshotting]Basic snapshotting[/goto]
    • [goto=sharing_updating]Sharing and updating[/goto]
  • [goto=sending_pull_requests]Sending pull requests[/goto]

  • [goto=concrete_example]Concrete example[/goto]


[anchor]signup_free_github_account[/anchor]Signup for a free GitHub account

GitHub is a web-based hosting service for software development projects that use the Git revision control system. We are hosting all our projects on this host. GitHub offers both commercial plans and free accounts for open source projects. You can register a free account by clicking here.

[anchor]download_install_git_machine[/anchor]Download and install Git on your machine

Git is a powerful, sophisticated system for distributed version control. It is all about composing and saving snapshots of your project and then working with and comparing those snapshots. It will pull down the whole project history, so you can browse history and even commit changes without online access. Thus Git works very well if you have an intermittent or poor network connection. These guides will step you through the process of downloading and installing Git in your operating system:

[anchor]generating_ssh_keys[/anchor]Generating SSH keys

SSH keys are used to secure communications between your machine and other machines. These guides will step you through the process of generating a keypair and uploading it to GitHub, depending on your Git client as well as your operating system:

[anchor]setup_username_email[/anchor]Setup username and e-mail

Git needs to know your username and email address to properly credit your commits. Setting this setting will also let GitHub link the commits you make to your GitHub account. Run the following commands to setup username (please use your registered username that we recognize you) and e-mail globally:
Codice: Seleziona tutto
$ git config --global "Your Username"
$ git config --global ""

You can also check this guide for a more detailed configuration with GitHub token.

[anchor]setup_line_ending_preferences[/anchor]Setup line ending preferences

Line endings is the scourge of every Windows-based developer that tries to mingle with Linux- or Mac-based developers. Though most modern text editors can handle both newline types without issue, Git is not as graceful. Run the following command to setup line ending preferences on Windows:
Codice: Seleziona tutto
$ git config --global core.autocrlf false


[anchor]forking_repository[/anchor]Forking a repository

Forking is to clone an entire remote repository into another remote repository. Now you have two repositories based around the same code base. At that one point in time, they have the same set of files and the same changelog. A fork is a copy located on GitHub which is then linked to the main repository as a child. To create a fork, simply click the Fork button on the GitHub project's page.

These projects may interest you because you can translate them in your local language:

[anchor]cloning_fork_locally[/anchor]Cloning the fork locally

Cloning is to make a copy of a remote repository into your local development environment, your machine. No one's got access to this machine or your clone. Run the following commands to clone the fork locally and make sure you use the Private URL, not the Public URL:
Codice: Seleziona tutto
$ git clone<project>.git

Once the clone is complete, your repository will have a remote named origin that points to your fork on GitHub. Don't let the name confuse you, this does not point to the original repository you forked from. To help you keep track of that repository, we will add another remote named upstream:
Codice: Seleziona tutto
$ cd <project>
$ git remote add upstream git://<project>.git
$ git fetch upstream

Note that we used the public clone URL for upstream, so you can't push changes directly to it. You don't have permission to do that anyway, which is why you're creating a fork in the first place.

[anchor]create_branch[/anchor]Create a branch

You must use branches, foreign main branches are never merged. Translations should have a branch named intl-<lang>, for example intl-de (German language). Please see the Sub-Project Contribution Guidelines for more information. So let's start by creating your new branch:
Codice: Seleziona tutto
$ git branch intl-<lang>

If you now run:
Codice: Seleziona tutto
$ git branch

You'll get a list of all existing branches:
Codice: Seleziona tutto
* master

The intl-<lang> branch is the one you just created, and the master branch is a default branch that was created for you automatically. The asterisk marks the branch you are currently on. To switch to your language branch, the intl-<lang> branch, simply run the following command:
Codice: Seleziona tutto
$ git checkout intl-<lang>

Want a helpful tip? You can also directly take a shortcut by running this command:
Codice: Seleziona tutto
$ git checkout -b intl-<lang>

This will create the intl-<lang> branch and immediately switch to it. Easy and magical!

[anchor]basic_snapshotting[/anchor]Basic snapshotting

Git is all about composing and saving snapshots of your project and then working with and comparing those snapshots. Instead of writing a documentation available everywhere, please read this section of the Git Reference website listing all the commands needed for basic snapshotting like [c]git add[/c], [c]git status[/c], [c]git diff[/c], [c]git commit[/c], [c]git reset HEAD[/c] and [c]git rm[/c].

[anchor]sharing_updating[/anchor]Sharing and updating

Git doesn't have a central server. All of the commands so far have been done locally, just updating a local database. To collaborate with other translators in Git, you have to put all that data on a server that the other translators have access to. The way Git does this is to synchronize your data with another repository. There is no real difference between a server and a client - a Git repository is a Git repository and you can synchronize between any two easily. Once you have a Git repository, either one that you set up on your own server, or one hosted someplace like GitHub, you can tell Git to either push any data that you have that is not in the remote repository up, or you can ask Git to fetch differences down from the other repo. Please read this section of the Git Reference website listing all the commands needed for basic snapshotting like [c]git remote[/c], [c]git fetch[/c], [c]git pull[/c], and [c]git push[/c].

[anchor]sending_pull_requests[/anchor]Sending pull requests

Pull requests let you tell others about changes you've pushed to a GitHub repository. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary. This guide walks through the process of sending a hypothetical pull request and using the various code review and management tools to take the change to completion.

[anchor]concrete_example[/anchor]Concrete example

Nothing is clearer than take a real example. As you know, I am IST/Translation Manager but also French and U.S. English translator. Let us take for example the AutoMOD project with the French translation.

After registering an account on GitHub (maelsoucaze as username) and downloaded and installed Git on my computer (I'm using Windows 7 as operating system), I am generating SSH keys:
Codice: Seleziona tutto
$ ssh-keygen -t rsa -C ""
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/maelsoucaze/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/maelsoucaze/.ssh/id_rsa.
Your public key has been saved in /c/Users/maelsoucaze/.ssh/
The key fingerprint is:

Now I'm launching my your browser and open my account page. In the "SSH Public Keys" section, I click on "Add another public key", then I paste my public key (stored in the file) into the "Key" field.

Now, I am going to set my username and e-mail adress:
Codice: Seleziona tutto
$ git config --global "Maël Soucaze"
$ git config --global ""

And my line ending preferences, especially because I am on Windows:
Codice: Seleziona tutto
$ git config --global core.autocrlf false

Now I am going to fork the AutoMOD repository by clicking on the appropriate button ; once the forking is done, I have the remote repository, identical to the official.

I'm cloning the fork locally, on my machine, into C:\Users\maelsoucaze\automod:
Codice: Seleziona tutto
$ git clone

And I will add another remote named "upstream" and reset "origin":
Codice: Seleziona tutto
$ cd automod
$ git remote add upstream git://
$ git fetch upstream
From git://
 * [new branch]      master     -> upstream/master
$ git remote rm origin
$ git remote add origin

Let's go working and submitting my language pack! After performing my French translation stored outside the local repository, I am going to create the French branch and switching to it:
Codice: Seleziona tutto
$ cd automod
$ git checkout -b intl-fr
Switched to a new branch 'intl-fr'

I can now copy my translation in the local repository and commit the files:
Codice: Seleziona tutto
$ git status -s
?? root/language/fr
$ git add .
$ git status -s
A root/language/fr/acp/mods.php
A root/language/fr/mods/info_acp_modman.php
$ git commit -m 'First commit. Adding my language pack to Git!'
[intl-fr b03eb80] First commit. Adding my language pack to Git!
 2 files changed, 4132 insertions(+), 0 deletions(-)
 create mode 100644 root/language/fr/acp/mods.php
 create mode 100644 root/language/fr/mods/info_acp_modman.php

All changes have been committed, I have to push all the files to my online repository on GitHub:
Codice: Seleziona tutto
$ git push origin intl-fr
Enter passphrase for key '/c/Users/maelsoucaze/.ssh/id_rsa':
Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 10.40 KiB, done.
Total 2 (delta 2), reused 0 (delta 0)
 * [new branch]      intl-fr -> intl-fr

Finally, open a pull request to repatriate my commits to the official repository. That's it! ;)

~ Erik

La creazione, il mantenimento e gli aggiornamenti per il progetto Portal XL Italia richiedono molto tempo e fatica, aiutaci con una donazione, tutte le info qui.

Tag: Git
© Portal XL Italia Group -
Questo articolo è stato modificato da Lucky il 10 apr 2011, 23:23

Chi c’è in linea

Iscritti connessi: Nessuno