FAQ Récupérer, mettre à jour les sources GIT du projet: Difference between revisions

Jump to navigation Jump to search
m
Titre d'une partie (test de modification avant de poursuivre la traduction de la doc en français)
m (Import interlang links (links to translated versions of this page in other languages) from origin English page "FAQ_Get,update_GIT_project_sources".)
m (Titre d'une partie (test de modification avant de poursuivre la traduction de la doc en français))
Line 11: Line 11:
Voici les informations sur comment récuperer et travailler avec les sources du projet Dolibarr.
Voici les informations sur comment récuperer et travailler avec les sources du projet Dolibarr.


=Recevoir la dernière version des sources par téléchargement =
=Recevoir la dernière version des sources par téléchargement=
Cette méthode vous permet de recevoir les sources de la branche de développement principale (Appelée HEAD). Cette opération consiste à récupérer la dernière version des fichiers de l'application Dolibarr qui sont compilées chaque nuit dans un fichier tgz. Ce fichier est disponible par le lien suivant:
Cette méthode vous permet de recevoir les sources de la branche de développement principale (Appelée HEAD). Cette opération consiste à récupérer la dernière version des fichiers de l'application Dolibarr qui sont compilées chaque nuit dans un fichier tgz. Ce fichier est disponible par le lien suivant:


Line 19: Line 19:


=Recevoir la dernière version des sources en utilisant un accès anonyme GIT.=
=Recevoir la dernière version des sources en utilisant un accès anonyme GIT.=
== Prérequis ==
==Prérequis==
* Avec l'IDE Eclipse
 
*Avec l'IDE Eclipse
 
Premièrement, vous devez avoir une installation fonctionnelle de Eclipse. Le plugin '''EGit''' doit aussi être installé.
Premièrement, vous devez avoir une installation fonctionnelle de Eclipse. Le plugin '''EGit''' doit aussi être installé.
Pour l'installer, utilisez '''Help''' depuis le menu Eclipse puis cliquez sur '''Install new software'''et cliquez sur '''Available software site'''. Dans la liste des adresses qui apparait, recherchez le lien :
Pour l'installer, utilisez '''Help''' depuis le menu Eclipse puis cliquez sur '''Install new software'''et cliquez sur '''Available software site'''. Dans la liste des adresses qui apparait, recherchez le lien :
Line 26: Line 28:
Puis, choisissez d'installer '''EGit'''.
Puis, choisissez d'installer '''EGit'''.


* Avec le client GIT en ligne de commande
*Avec le client GIT en ligne de commande
 
Pour récuperer les sources dans l'intention de les modifier, vous avez besoin d'un compte GitHub, et un client GIT (Les outils GIT en ligne de commande Linux, ou le client GIT d'Eclipse).
Pour récuperer les sources dans l'intention de les modifier, vous avez besoin d'un compte GitHub, et un client GIT (Les outils GIT en ligne de commande Linux, ou le client GIT d'Eclipse).


== Processus de Clone ==
==Processus de Clone==
{{ToTranslate}}
{{ToTranslate}}
First, enter value of the repository with reference sources into your GIT client tool.
First, enter value of the repository with reference sources into your GIT client tool.


* Avec l'IDE Eclipse, choose "Clone GIT repository". Enter GIT URL of project to get.
*Avec l'IDE Eclipse, choose "Clone GIT repository". Enter GIT URL of project to get.
 
GIT Url for Dolibarr official source is:
GIT Url for Dolibarr official source is:
<source lang="ini">
<source lang="ini">
Line 42: Line 46:
Your Eclipse GIT client will ask you to choose the branches you are interesting in. Branches not selected now could be selected later by doing a "Fetch" from the "Remotes" view, but try to choose only the branch you need. This will save you time and problems later.
Your Eclipse GIT client will ask you to choose the branches you are interesting in. Branches not selected now could be selected later by doing a "Fetch" from the "Remotes" view, but try to choose only the branch you need. This will save you time and problems later.


* Avec le client GIT en ligne de commande:
*Avec le client GIT en ligne de commande:
 
First setup your git client:
First setup your git client:
<source lang="bash">
<source lang="bash">
Line 64: Line 69:


If not:
If not:
* Avec Eclipse, right click on "Branches - Remotes - The branch you want to duplicate locally".
 
*Avec Eclipse, right click on "Branches - Remotes - The branch you want to duplicate locally".
 
If you choose "Create Branch", this will duplicate content of branch to work on it locally.
If you choose "Create Branch", this will duplicate content of branch to work on it locally.
If you Choose "Checkout", this will update the view "Working Directory".
If you Choose "Checkout", this will update the view "Working Directory".
* With GIT on Command Line Interface
 
*With GIT on Command Line Interface
 
<source lang="bash">
<source lang="bash">
git checkout develop
git checkout develop
Line 85: Line 94:


=Récupérer la dernière version des sources avec un accès GIT complet=
=Récupérer la dernière version des sources avec un accès GIT complet=
== Prérequis ==
==Prérequis==
First you must have a working install of Eclipse. '''EGit''' plugin must also have been installed.
First you must have a working install of Eclipse. '''EGit''' plugin must also have been installed.
For this, use the '''Find And Install process''' into Eclipse menu, add the GIT update URL:  
For this, use the '''Find And Install process''' into Eclipse menu, add the GIT update URL:  
Line 93: Line 102:
You must before create an account on GitHub (https://github.com/) and upload a public RSA or DSA certificate into your account profile.
You must before create an account on GitHub (https://github.com/) and upload a public RSA or DSA certificate into your account profile.


== Processus de clone ==
==Processus de clone==
Le processus est le même que pour récupérer les sources de manière anonyme (voir ci-dessus), seule l'URL d'accès change.
Le processus est le même que pour récupérer les sources de manière anonyme (voir ci-dessus), seule l'URL d'accès change.


Line 110: Line 119:


If you made some changes into your Eclipse workspace on files that were changed into the GIT remote reference, your GIT client will make a merge automatically.
If you made some changes into your Eclipse workspace on files that were changed into the GIT remote reference, your GIT client will make a merge automatically.
* If there is conflicts, the merge will mark all conflict files as "conflict" (See later to solve this state).
 
* If not, you will get all new version files including all your changes.
*If there is conflicts, the merge will mark all conflict files as "conflict" (See later to solve this state).
*If not, you will get all new version files including all your changes.


If you already have commited some files into your local repository, your workspace will be marked as "Merged".
If you already have commited some files into your local repository, your workspace will be marked as "Merged".
All you have to do is make a commit to validate your local repository as including your changes and changes made by others.
All you have to do is make a commit to validate your local repository as including your changes and changes made by others.


= Commit and publish your changes =
=Validez et publiez vos modifications=
To see all changes you made into your working directory and waiting to be added into Git:
To see all changes you made into your working directory and waiting to be added into Git:
* With GIT Command Line Interface:
 
*With GIT Command Line Interface:
 
<source lang="bash">
<source lang="bash">
git status
git status
Line 125: Line 137:


To add changes made into your local repository into the GIT index, then commit this index :
To add changes made into your local repository into the GIT index, then commit this index :
* With Eclipse: Right click on file or directory to commit. Select file to add/remove/update into commit.
 
* With GIT Command Line Interface:
*With Eclipse: Right click on file or directory to commit. Select file to add/remove/update into commit.
*With GIT Command Line Interface:
 
<source lang="bash">
<source lang="bash">
git commit -a -m "Commit text"
git commit -a -m "Commit text"
Line 133: Line 147:


To push them on the GIT repository server,
To push them on the GIT repository server,
* With Eclipse: right click on project and choose "'''Team - Push to Upstream'''".
 
* With GIT Command Line Interface:
*With Eclipse: right click on project and choose "'''Team - Push to Upstream'''".
*With GIT Command Line Interface:
 
<source lang="bash">
<source lang="bash">
git push
git push
Line 140: Line 156:


To cancel a commit:
To cancel a commit:
* With GIT Command Line Interface:
 
*With GIT Command Line Interface:
 
<source lang="bash">
<source lang="bash">
git revert IdCommit  or  git revert HEAD  (for last commit)
git revert IdCommit  or  git revert HEAD  (for last commit)
</source>
</source>


= Ajout un commit exterieur dans votre repository courant =
=Ajout un commit exterieur dans votre repository courant=
Some developers may work and do commit into their own Git repository after forking the project. If you are interesting into getting this changes, you can import them with the following steps with Eclipse:
Some developers may work and do commit into their own Git repository after forking the project. If you are interesting into getting this changes, you can import them with the following steps with Eclipse:
* First, go into GIT setup view and right click on "'''Remotes'''" of your Eclipse Git working space and choose "'''Create a remote...'''"
 
* Type name or remote fork the developer has create (in most cases, it's developer Git login). For example: "'''thedevlogin'''". Choose also "'''Configure Fetch'''".
*First, go into GIT setup view and right click on "'''Remotes'''" of your Eclipse Git working space and choose "'''Create a remote...'''"
* Type URI of Git repository of developer. For example: '''git://github.com/thedevlogin/dolibarr.git'''. Also add a refspec value to declare the branch you want to get. For example: '''refs/heads/master:refs/remotes/thedevlogin/master'''. Click "'''Save and Fetch'''". A new entry will be added into "Remote Tracking" making possible to read/get commits done into this branch.
*Type name or remote fork the developer has create (in most cases, it's developer Git login). For example: "'''thedevlogin'''". Choose also "'''Configure Fetch'''".
*Type URI of Git repository of developer. For example: '''git://github.com/thedevlogin/dolibarr.git'''. Also add a refspec value to declare the branch you want to get. For example: '''refs/heads/master:refs/remotes/thedevlogin/master'''. Click "'''Save and Fetch'''". A new entry will be added into "Remote Tracking" making possible to read/get commits done into this branch.


Now, go on command line of your git repository (in most cases on Linux, it's '''/home/yourlogin/git/yourdolibarr''') and type the git cherry-pick command:
Now, go on command line of your git repository (in most cases on Linux, it's '''/home/yourlogin/git/yourdolibarr''') and type the git cherry-pick command:
Line 171: Line 190:


If you prefer to forget completely all changes you made into all files (so to restore you workspace with content of remote repository), you can make a hard reset:
If you prefer to forget completely all changes you made into all files (so to restore you workspace with content of remote repository), you can make a hard reset:
* With Eclipse, right click on project top line and select "'''Reset'''" then "'''Hard'''" then "'''Reference - HEAD'''".
 
* Using GIT command line tool, you can achieve this with command
*With Eclipse, right click on project top line and select "'''Reset'''" then "'''Hard'''" then "'''Reference - HEAD'''".
*Using GIT command line tool, you can achieve this with command
 
<source lang="bash">
<source lang="bash">
git reset --hard HEAD  
git reset --hard HEAD  
Line 206: Line 227:


Pour compter le nombre de changerment qu'un développeur a fait entre une version x et y:
Pour compter le nombre de changerment qu'un développeur a fait entre une version x et y:
* First, run git merge-base to know the id of last common commit between x and y
 
*First, run git merge-base to know the id of last common commit between x and y
 
<source lang="bash">
<source lang="bash">
git merge-base origin/3.1 origin/develop
git merge-base origin/3.1 origin/develop
</source>
</source>
* Then run git log to have list of all changes from last common commit to last commit
 
*Then run git log to have list of all changes from last common commit to last commit
 
<source lang="bash">
<source lang="bash">
git log id_found_at_previous_step..HEAD
git log id_found_at_previous_step..HEAD
</source>
</source>
* To get total number of added/deleted lines:
 
*To get total number of added/deleted lines:
 
<source lang="bash">
<source lang="bash">
git log --ancestry-path --numstat --pretty="%H" id_found_at_previous_step..HEAD | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
git log --ancestry-path --numstat --pretty="%H" id_found_at_previous_step..HEAD | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
Line 221: Line 248:


To count number of changes finally between a version x and y (it differs from previous count because in previous count, a change can be done 2 times at two different moment to change differently. With second method, you count change finally found if changes were ok at first try):
To count number of changes finally between a version x and y (it differs from previous count because in previous count, a change can be done 2 times at two different moment to change differently. With second method, you count change finally found if changes were ok at first try):
* Use same method than previously but instead of running git log, run git diff.
 
*Use same method than previously but instead of running git log, run git diff.
 
<source lang="bash">
<source lang="bash">
git diff -b -M --numstat --pretty="%H" id_found_at_previous_step..HEAD | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
git diff -b -M --numstat --pretty="%H" id_found_at_previous_step..HEAD | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'

Navigation menu