Difference between revisions of "Source code management/fr"

From FreeCAD Documentation
Jump to navigation Jump to search
(Updating to match new version of source page)
Line 1: Line 1:
Our main source code management tool is [http://en.wikipedia.org/wiki/Git_%28software%29 git]. This article explains how to use it and how some general rules apply in the case of FreeCAD. You are highly advised to learn how git works first (there are a lot of tutorials and docs available for git on the internet) before working with the FreeCAD source code.
+
Notre principal outil de gestion de code est [http://en.wikipedia.org/wiki/Git_%28software%29 git]. Cet article explique comment l'utiliser et les règles générales qui s'appliquent dans le cas de FreeCAD. Il est fortement recommandé d'apprendre comment fonctionne git (il existe beaucoup d'informations et de tutoriels à propos de git sur internet) avant de travailler avec le code source de FreeCAD.
  
Il existe également de nombreux bons clients graphiques pour git, comme par exemple [http://github.com/git-cola/git-cola git-cola], qui rendent le processus de management des dépôts git plus facile.
+
Il existe également de nombreux bons clients graphiques pour git, comme par exemple [http://github.com/git-cola/git-cola git-cola], qui rendent le processus de management des dépôts git plus facile.
  
 
== Source Code Access ==
 
== Source Code Access ==
 
Everybody can access and get a copy of the FreeCAD source code, but only the FreeCAD project managers have write access to it. You can get a copy of the code, study it and modify it as you wish, but if you make a change that you wish to see included in the official source code, you need to ask for a pull request on the [http://forum.freecadweb.org/viewforum.php?f=17 pull requests] section of the FreeCAD forum.
 
Everybody can access and get a copy of the FreeCAD source code, but only the FreeCAD project managers have write access to it. You can get a copy of the code, study it and modify it as you wish, but if you make a change that you wish to see included in the official source code, you need to ask for a pull request on the [http://forum.freecadweb.org/viewforum.php?f=17 pull requests] section of the FreeCAD forum.
  
{{Note|NOTE|In all examples below, "USERNAME" represents your GitHub user account.}}
+
{{Note|NOTE|In all examples below, "GITHUB_USERNAME" represents your GitHub user account.}}
  
 
=== Official GitHub Repo ===
 
=== Official GitHub Repo ===
 
An easy way to start with the FreeCAD source code is using the official FreeCAD repository at
 
An easy way to start with the FreeCAD source code is using the official FreeCAD repository at
https://github.com/FreeCAD/FreeCAD
+
'''https://github.com/FreeCAD/FreeCAD'''
  
 
=== Setting your git username ===
 
=== Setting your git username ===
Line 16: Line 16:
 
If that is not already set globally, you can set it locally for the current Git repository like this:
 
If that is not already set globally, you can set it locally for the current Git repository like this:
 
  git config user.name "YOUR NAME"
 
  git config user.name "YOUR NAME"
  git config user.email "USERNAME@users.noreply.github.com"
+
  git config user.email "GITHUB_USERNAME@users.noreply.github.com"
 
Vous pouvez maintenant utiliser une combinaison de commandes "'''git add'''" et "'''git commit'''" pour créer un, ou plusieurs commits dans votre dépôt local.
 
Vous pouvez maintenant utiliser une combinaison de commandes "'''git add'''" et "'''git commit'''" pour créer un, ou plusieurs commits dans votre dépôt local.
  
==== Fork on GitHub ====
+
==== A note about Remotes ====
You can start simply by using the "fork" button on top of the above page. This will create a copy of the FreeCAD repository on your own GitHub account. The general procedure is as follows:
+
Please read some [https://stackoverflow.com/questions/9257533/what-is-the-difference-between-origin-and-upstream-on-github#9257901 background] to help you understand better the difference between what '''origin''' and '''upstream''' mean in the context of git. This section explains how to set the correct upstream and origin remote git repos.  
# [https://github.com/join Sign up] for a GitHub account
+
Essentially:  
# Go to the FreeCAD repohttps://github.com/FreeCAD/FreeCAD
+
* '''origin''' = Your fork of the FreeCAD git repo AKA https://github.com/GITHUB_USERNAME/FreeCAD.git
# Press the "Fork" button
+
* '''upstream''' = The official FreeCAD git repo AKA https://github.com/FreeCAD/FreeCAD.git
# On your machine, clone your newly created FreeCAD fork:
+
This is important to understand because if you git clone directly from upstream then confusingly, your origin will be listed as https://github.com/FreeCAD/FreeCAD.git
#:  <pre>git clone https://github.com/USERNAME/FreeCAD.git</pre>
+
So, based on the above, there are 2 main ways to setup your git environment:
# Create and checkout a new branch simultaneously
+
* [[Source_code_management#Clone_Official_FreeCAD_git_repo_to_your_local_machine|1st Method: Fork on GitHub and clone your fork locally]]
#: <pre>git checkout -b newfeature</pre>
+
* [[Source_code_management#Clone_Official_FreeCAD_git_repo_to_your_local_machine|2nd Method: Clone FreeCAD official directly to your local machine]]
# Commit your changes to that new branch
+
We recommend the 1st method for the reason mentioned above.
# Push that new branch to your GitHub repo
 
  
==== Git clone to your local machine ====
+
==== 1st Method: Fork on GitHub and clone your fork locally ====
You can also start normally, without using the "fork" button:
+
{{Note|Important Note|You will need to re-configure  'remote upstream' as mentioned above in "[[Source_code_management#A_note_about_Remotes|A note about Remotes]]"}}
# Clone the FreeCAD code with git:  
+
This method is the recommended way since it takes less steps. You will essentially fork the FreeCAD repo on your own GitHub account and then clone said GitHub fork locally. Then you will set your '''upstream''' repo in git. The procedure is as follows:
#: <pre>git clone https://github.com/FreeCAD/FreeCAD.git</pre>
+
<ol>
# Create and checkout a new branch simultaneously
+
<li>[https://github.com/join Sign up] for a GitHub account if you don't already have one </li>
#:  <pre>git checkout -b newfeature</pre>
+
<li>Go to the FreeCAD repo:  https://github.com/FreeCAD/FreeCAD</li>
# Commit your changes to that new branch
+
<li>In the top right of the page find and press the "Fork" button (this will essentially git clone the official FreeCAD repo to your personal GitHub repo: https://github.com/GITHUB_USERNAME/FreeCAD.git)  </li>
# Create an account on a public git server (GitHub, GitLab, etc...)
+
<li>On your machine, clone your newly created FreeCAD fork by opening a terminal and typing:
# Push your branch to that server
+
  <pre>git clone https://github.com/GITHUB_USERNAME/FreeCAD.git</pre></li>
 +
<li>Once the clone process is complete, now set your '''upstream''' remote repo (see "[[Source_code_management#A_note_about_Remotes|A note about Remotes]]"). Find out what and where your remote git repositories are set to. Type '''git remote -v''' and the output should look similiar to:
 +
  <pre> [foo@bar FreeCAD]$ git remote -v
 +
    origin https://github.com/GITHUB_USERNAME/FreeCAD.git (fetch)
 +
    origin https://github.com/GITHUB_USERNAME/FreeCAD.git (push)</pre></li>
 +
  <li>Great. Now set your '''upstream''' repo
 +
  <pre>[foo@bar FreeCAD]$ git remote add upstream https://github.com/FreeCAD/FreeCAD.git</pre></li>
 +
<li>Check your remotes again, they should look similiar to this:
 +
    <pre> [foo@bar FreeCAD]$ git remote -v
 +
    origin https://github.com/GITHUB_USERNAME/FreeCAD.git (fetch)
 +
    origin https://github.com/GITHUB_USERNAME/FreeCAD.git (push)
 +
    upstream https://github.com/FreeCAD/FreeCAD.git (fetch)
 +
    upstream https://github.com/FreeCAD/FreeCAD.git (push)</pre></li>
 +
</li>
 +
  <li>Now we can start developing. Please refer to "[[Source_code_management#Git_Development_Process|Git Development Process]]"</li>
 +
</ol>
  
''Important Note'': If you have code you wish to see merged into the FreeCAD source code, please post a note in the [http://forum.freecadweb.org/viewforum.php?f=17 Pull Requests] section of the FreeCAD forum.
+
==== 2nd Method: Clone Official FreeCAD git repo to your local machine  ====
 
+
{{Note|Important Note|You will need to re-configure both 'remote origin' and 'remote upstream' please refer to above "[[Source_code_management#A_note_about_Remotes|A note about Remotes]]"}}
=== Alternative repositories ===
+
This method of setuping your git environment takes a few more steps then the 1st method. You will clone the FC git repo directly to your local machine and then alter your remotes via the terminal. The procedure is as follows:
The beauty of git is that everybody can clone a project, and start modifying the code. Several frequent collaborators of the FreeCAD project have their own git repository, where they build up their work before it is ready to be included in the official source code, or simply where they experiment new ideas. In certain cases, you might want to clone your FreeCAD code from one of these, instead of the official repos, to benefit from the changes their users did.
+
<ol>
 
+
<li>Clone the FreeCAD code with git:
Be warned, though, that this is at your own risk, and only the official repository above is fully guaranteed to work and contain clean code.
+
  <pre>git clone https://github.com/FreeCAD/FreeCAD.git</pre></li>
 
+
<li>Create an account on a public git server (GitHub, GitLab, etc... for our purposes we're assuming it's GitHub)</li>
Il est également possible de lier plusieurs dépôts distants avec un seul code local, en utilisant la commande "git remote". C'est pratique pour rester synchronisé avec la branche "master", mais gardez un œil sur le travail des différents dévelopers.
+
<li>Find out what and where your remote git repositories are set to:
 +
    <pre>git remote -v</pre></li>
 +
  <li>This will return something that looks like the following:
 +
    <pre>[foo@bar FreeCAD]$ git remote -v
 +
    origin https://github.com/FreeCAD/FreeCAD.git (fetch)
 +
    origin https://github.com/FreeCAD/FreeCAD.git (push)</pre></li>
 +
  <li>As was explained above in "[[Source_code_management#A_note_about_Remotes|A note about Remotes]]" you need to modify these remote git repo addresses.<br />
 +
So first set up your '''origin''' remote:
 +
    <pre>[foo@bar FreeCAD]$ git remote add origin https://github.com/GITHUB_USERNAME/FreeCAD.git</pre></li>
 +
  <li>Then we set up our '''upstream''' remote:
 +
    <pre>[foo@bar FreeCAD]$ git remote add upstream https://github.com/FreeCAD/FreeCAD.git</pre></li>
 +
  <li>Check your remotes again, they should look similiar to this:
 +
    <pre> [foo@bar FreeCAD]$ git remote -v
 +
    origin https://github.com/GITHUB_USERNAME/FreeCAD.git (fetch)
 +
    origin https://github.com/GITHUB_USERNAME/FreeCAD.git (push)
 +
    upstream https://github.com/FreeCAD/FreeCAD.git (fetch)
 +
    upstream https://github.com/FreeCAD/FreeCAD.git (push)</pre></li>
 +
  <li>Now we can start developing. Please refer to "[[Source_code_management#Git_Development_Process|Git Development Process]]"</li>
 +
</ol>
  
 
== Git Development Process ==
 
== Git Development Process ==
First of all '''never develop on the ''master'' branch!''' Create a local branch for development.  
+
First of all '''NEVER DEVELOP ON THE ''master'' BRANCH!'''  
You can learn how to do this [http://book.git-scm.com/3_basic_branching_and_merging.html here].
+
Instead, create a local branch for development. You can learn in more depth by reading [https://book.git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging Git-Branching-Basic-Branching-and-Merging chapter on git-scm]. Below is a summary:
  
 
=== Ramifications ===
 
=== Ramifications ===
Line 65: Line 97:
 
vous pouvez toujours vérifier, dans quelle branche vous êtes avec :
 
vous pouvez toujours vérifier, dans quelle branche vous êtes avec :
 
  git branch
 
  git branch
 +
 
=== Soumettre ===
 
=== Soumettre ===
  
 
Une fois que vous avez fait un peu de travail, validez le avec :
 
Une fois que vous avez fait un peu de travail, validez le avec :
git commit -a
+
<pre>git commit -a</pre>
 
Contrairement à [http://fr.wikipedia.org/wiki/Apache_Subversion SVN], vous devez informer avec précision les fichiers à envoyer (ou la totalité avec l'option '''-a'''). Votre éditeur de texte s'ouvrira, pour vous permettre d'écrire un message de validation.
 
Contrairement à [http://fr.wikipedia.org/wiki/Apache_Subversion SVN], vous devez informer avec précision les fichiers à envoyer (ou la totalité avec l'option '''-a'''). Votre éditeur de texte s'ouvrira, pour vous permettre d'écrire un message de validation.
  
 
=== Publishing your work on your GitHub repository===
 
=== Publishing your work on your GitHub repository===
After done some changes on your local branch and commit it (this means commit
+
{{Note|Important Note|If you have code you wish to see merged into the FreeCAD source code, please post a note in the Pull Request section of the FreeCAD forum}}
''locally'') you can push your repository to the server. This opens your branch  
+
After you're correctly branched made some modifications to your local branch and commit them 'locally', you can push your repository to your remote git server (in this example we're assuming GitHub). This opens your branch to the public and allows the main developers to review and integrate your branch into ''master''.  
to the public and allows the main developers to review and integrate your  
+
  git push <REMOTENAME> <BRANCHNAME>
branch into ''master''.  
+
git push origin my-branch
  git push my-branch
+
<small>For further info on this subject please read https://help.github.com/articles/pushing-to-a-remote/</small>
  
 
=== Rédaction de bons messages de commit ===
 
=== Rédaction de bons messages de commit ===
Line 98: Line 131:
 
Ensuite, lorsque vous effectuez la fusion, utilisez l'option '''--squash''', et, engagez avec le message de validation (commits) de qualité.
 
Ensuite, lorsque vous effectuez la fusion, utilisez l'option '''--squash''', et, engagez avec le message de validation (commits) de qualité.
 
Cela vous permettra d'être très libéral avec votre '''commit''', et, aidez à assurer un bon niveau de détails des messages de '''commit''' sans faire trop de descriptions distinctes.
 
Cela vous permettra d'être très libéral avec votre '''commit''', et, aidez à assurer un bon niveau de détails des messages de '''commit''' sans faire trop de descriptions distinctes.
 +
 +
== Advanced git operations ==
 +
=== Resolving Merge Conflicts ===
 +
* [https://git-scm.com/docs/git-merge#_how_conflicts_are_presented git-scm explanation on how conflicts are presented]
 +
* [https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ GitHub article on resolving merge conflicts via the command-line]
 +
* [https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_external_merge_tools Customize your preferred merge tool] when you encounter a git conflict.
 +
 +
=== Applying patches via git ===
 +
Git has the capability to merge patches/diffs. To read more about this read the following reference: https://www.drupal.org/node/1399218
 +
* Useful tip:  Just add .diff or .patch at the end of the URL for a GitHub commit page, Pull Request, or Compare View and it'll show you the plaintext view of that page. Example:
 +
Regular GitHub page:
 +
<small>https://github.com/FreeCAD/FreeCAD/commit/c476589652a0f67b544735740e20ff702e8d0621</small>
 +
 +
'Diffed' GitHub page:
 +
<small>https://github.com/FreeCAD/FreeCAD/commit/c476589652a0f67b544735740e20ff702e8d0621.diff</small>
 +
 +
'Patched' GitHub page:
 +
<small>https://github.com/FreeCAD/FreeCAD/commit/c476589652a0f67b544735740e20ff702e8d0621.patch</small>
 +
 +
==== Apply a patch via curl ====
 +
curl https://github.com/FreeCAD/FreeCAD/commit/c476589652a0f67b544735740e20ff702e8d0621.patch | git apply -
 +
 +
== Alternative repositories ==
 +
The beauty of git is that everybody can clone a project, and start modifying the code. Several frequent collaborators of the FreeCAD project have their own git repository, where they build up their work before it is ready to be included in the official source code, or simply where they experiment new ideas. In certain cases, you might want to clone your FreeCAD code from one of these, instead of the official repos, to benefit from the changes their users did.
 +
 +
Be warned, though, that this is at your own risk, and only the official repository above is fully guaranteed to work and contain clean code.
 +
 +
Il est également possible de lier plusieurs dépôts distants avec un seul code local, en utilisant la commande "git remote". C'est pratique pour rester synchronisé avec la branche "master", mais gardez un œil sur le travail des différents dévelopers.
 +
 +
== Using git in a Graphical User Interface ==
 +
* [[Developing FreeCAD with GitKraken]]
  
 
== Lecture complémentaire ==
 
== Lecture complémentaire ==

Revision as of 08:18, 28 October 2017

Notre principal outil de gestion de code est git. Cet article explique comment l'utiliser et les règles générales qui s'appliquent dans le cas de FreeCAD. Il est fortement recommandé d'apprendre comment fonctionne git (il existe beaucoup d'informations et de tutoriels à propos de git sur internet) avant de travailler avec le code source de FreeCAD.

Il existe également de nombreux bons clients graphiques pour git, comme par exemple git-cola, qui rendent le processus de management des dépôts git plus facile.

Source Code Access

Everybody can access and get a copy of the FreeCAD source code, but only the FreeCAD project managers have write access to it. You can get a copy of the code, study it and modify it as you wish, but if you make a change that you wish to see included in the official source code, you need to ask for a pull request on the pull requests section of the FreeCAD forum.

NOTE

In all examples below, "GITHUB_USERNAME" represents your GitHub user account.


Official GitHub Repo

An easy way to start with the FreeCAD source code is using the official FreeCAD repository at https://github.com/FreeCAD/FreeCAD

Setting your git username

Users should commit to their project repository using their GitHub username. If that is not already set globally, you can set it locally for the current Git repository like this:

git config user.name "YOUR NAME"
git config user.email "GITHUB_USERNAME@users.noreply.github.com"

Vous pouvez maintenant utiliser une combinaison de commandes "git add" et "git commit" pour créer un, ou plusieurs commits dans votre dépôt local.

A note about Remotes

Please read some background to help you understand better the difference between what origin and upstream mean in the context of git. This section explains how to set the correct upstream and origin remote git repos. Essentially:

This is important to understand because if you git clone directly from upstream then confusingly, your origin will be listed as https://github.com/FreeCAD/FreeCAD.git So, based on the above, there are 2 main ways to setup your git environment:

We recommend the 1st method for the reason mentioned above.

1st Method: Fork on GitHub and clone your fork locally

Important Note

You will need to re-configure 'remote upstream' as mentioned above in "A note about Remotes"

This method is the recommended way since it takes less steps. You will essentially fork the FreeCAD repo on your own GitHub account and then clone said GitHub fork locally. Then you will set your upstream repo in git. The procedure is as follows:

  1. Sign up for a GitHub account if you don't already have one
  2. Go to the FreeCAD repo: https://github.com/FreeCAD/FreeCAD
  3. In the top right of the page find and press the "Fork" button (this will essentially git clone the official FreeCAD repo to your personal GitHub repo: https://github.com/GITHUB_USERNAME/FreeCAD.git)
  4. On your machine, clone your newly created FreeCAD fork by opening a terminal and typing:
    git clone https://github.com/GITHUB_USERNAME/FreeCAD.git
  5. Once the clone process is complete, now set your upstream remote repo (see "A note about Remotes"). Find out what and where your remote git repositories are set to. Type git remote -v and the output should look similiar to:
     [foo@bar FreeCAD]$ git remote -v
         origin	https://github.com/GITHUB_USERNAME/FreeCAD.git (fetch)
         origin	https://github.com/GITHUB_USERNAME/FreeCAD.git (push)
  6. Great. Now set your upstream repo
    [foo@bar FreeCAD]$ git remote add upstream https://github.com/FreeCAD/FreeCAD.git
  7. Check your remotes again, they should look similiar to this:
     [foo@bar FreeCAD]$ git remote -v
        origin	https://github.com/GITHUB_USERNAME/FreeCAD.git (fetch)
        origin	https://github.com/GITHUB_USERNAME/FreeCAD.git (push)
        upstream	https://github.com/FreeCAD/FreeCAD.git (fetch)
        upstream	https://github.com/FreeCAD/FreeCAD.git (push)
  8. Now we can start developing. Please refer to "Git Development Process"

2nd Method: Clone Official FreeCAD git repo to your local machine

Important Note

You will need to re-configure both 'remote origin' and 'remote upstream' please refer to above "A note about Remotes"

This method of setuping your git environment takes a few more steps then the 1st method. You will clone the FC git repo directly to your local machine and then alter your remotes via the terminal. The procedure is as follows:

  1. Clone the FreeCAD code with git:
    git clone https://github.com/FreeCAD/FreeCAD.git
  2. Create an account on a public git server (GitHub, GitLab, etc... for our purposes we're assuming it's GitHub)
  3. Find out what and where your remote git repositories are set to:
    git remote -v
  4. This will return something that looks like the following:
    [foo@bar FreeCAD]$ git remote -v
        origin https://github.com/FreeCAD/FreeCAD.git (fetch)
        origin https://github.com/FreeCAD/FreeCAD.git (push)
  5. As was explained above in "A note about Remotes" you need to modify these remote git repo addresses.
    So first set up your origin remote:
    [foo@bar FreeCAD]$ git remote add origin https://github.com/GITHUB_USERNAME/FreeCAD.git
  6. Then we set up our upstream remote:
    [foo@bar FreeCAD]$ git remote add upstream https://github.com/FreeCAD/FreeCAD.git
  7. Check your remotes again, they should look similiar to this:
     [foo@bar FreeCAD]$ git remote -v
        origin	https://github.com/GITHUB_USERNAME/FreeCAD.git (fetch)
        origin	https://github.com/GITHUB_USERNAME/FreeCAD.git (push)
        upstream	https://github.com/FreeCAD/FreeCAD.git (fetch)
        upstream	https://github.com/FreeCAD/FreeCAD.git (push)
  8. Now we can start developing. Please refer to "Git Development Process"

Git Development Process

First of all NEVER DEVELOP ON THE master BRANCH! Instead, create a local branch for development. You can learn in more depth by reading Git-Branching-Basic-Branching-and-Merging chapter on git-scm. Below is a summary:

Ramifications

Une caractéristique importante de Git, est qu'il est extrêmement facile de travailler avec des branches, et, les fusionner. La meilleure pratique recommande de créer une nouvelle branche à chaque fois que vous voulez travailler sur une nouvelle fonctionnalité.

Création d'une branche se fait avec :

git branch myNewBranch
git checkout myNewBranch

ou, les deux opérations en un seule :

git checkout -b myNewBranch

vous pouvez toujours vérifier, dans quelle branche vous êtes avec :

git branch

Soumettre

Une fois que vous avez fait un peu de travail, validez le avec :

git commit -a

Contrairement à SVN, vous devez informer avec précision les fichiers à envoyer (ou la totalité avec l'option -a). Votre éditeur de texte s'ouvrira, pour vous permettre d'écrire un message de validation.

Publishing your work on your GitHub repository

Important Note

If you have code you wish to see merged into the FreeCAD source code, please post a note in the Pull Request section of the FreeCAD forum

After you're correctly branched made some modifications to your local branch and commit them 'locally', you can push your repository to your remote git server (in this example we're assuming GitHub). This opens your branch to the public and allows the main developers to review and integrate your branch into master.

git push  <REMOTENAME> <BRANCHNAME> 
git push origin my-branch

For further info on this subject please read https://help.github.com/articles/pushing-to-a-remote/

Rédaction de bons messages de commit

Vous devriez essayer de travailler en petites sections. Si vous ne pouvez pas résumer vos modifications en une seule phrase, il y a probablement trop longtemps, que vous avez fait un commit. Il est également important de donner une descriptions détaillée, et, utile de votre travail. Pour les messages de commit, FreeCAD a adopté un format qui est mentionné dans le livre Git Pro.

 Court sommaire des changements (50 caractères ou plus)
Si nécessaire, bien détailler les textes explicatifs. Ecrivez-en environ 72 caractères ou plus.
Dans certains cas, la première ligne est considérée comme l'objet (résumé) d'un email, et, le reste du texte comme le corps.
Laisser une ligne blanche pour séparer le résumé, du corps du message (sauf si vous omettez l’entièreté corps);
des outils comme rebase peut se confondre si vous exécutez les deux ensemble.
Les paragraphes supplémentaires, viennent après les lignes vides.
* Les puces sont très bien aussi
- En général, un trait d'union ou un astérisque est utilisé pour la puce, précédé d'un
  espace unique, avec des lignes blanches entre les deux, mais ici les conventions varient.

Si vous faites beaucoup de travaux connexes, il a été suggéré ici, que l'on doit faire autant de commits que possible, grand ou petit, dans le sens que vous utilisez des messages avec de courtes phrases. Lorsque vous souhaitez faire une fusion, faites un journal log master git .. BRANCH, et, utilisez la sortie comme une base, pour la qualité de votre commit message. Ensuite, lorsque vous effectuez la fusion, utilisez l'option --squash, et, engagez avec le message de validation (commits) de qualité. Cela vous permettra d'être très libéral avec votre commit, et, aidez à assurer un bon niveau de détails des messages de commit sans faire trop de descriptions distinctes.

Advanced git operations

Resolving Merge Conflicts

Applying patches via git

Git has the capability to merge patches/diffs. To read more about this read the following reference: https://www.drupal.org/node/1399218

  • Useful tip: Just add .diff or .patch at the end of the URL for a GitHub commit page, Pull Request, or Compare View and it'll show you the plaintext view of that page. Example:

Regular GitHub page: https://github.com/FreeCAD/FreeCAD/commit/c476589652a0f67b544735740e20ff702e8d0621

'Diffed' GitHub page: https://github.com/FreeCAD/FreeCAD/commit/c476589652a0f67b544735740e20ff702e8d0621.diff

'Patched' GitHub page: https://github.com/FreeCAD/FreeCAD/commit/c476589652a0f67b544735740e20ff702e8d0621.patch

Apply a patch via curl

curl https://github.com/FreeCAD/FreeCAD/commit/c476589652a0f67b544735740e20ff702e8d0621.patch | git apply -

Alternative repositories

The beauty of git is that everybody can clone a project, and start modifying the code. Several frequent collaborators of the FreeCAD project have their own git repository, where they build up their work before it is ready to be included in the official source code, or simply where they experiment new ideas. In certain cases, you might want to clone your FreeCAD code from one of these, instead of the official repos, to benefit from the changes their users did.

Be warned, though, that this is at your own risk, and only the official repository above is fully guaranteed to work and contain clean code.

Il est également possible de lier plusieurs dépôts distants avec un seul code local, en utilisant la commande "git remote". C'est pratique pour rester synchronisé avec la branche "master", mais gardez un œil sur le travail des différents dévelopers.

Using git in a Graphical User Interface

Lecture complémentaire

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano