Note
Cu toate că pentru a demonstra procesul se folosește Documentația QGIS, comenzile și etapele prezentate mai jos se aplică întregului site QGIS.
Acum, o dată ce cunoașteți regulile de urmat pentru a scrie un document adecvat pentru QGIS, vom intra în procesul de producție a acestei documentații, și în partajarea rapidă și în condiții de siguranță a modificărilor cu comunitatea.
Assuming you already have a GitHub account, you first need to clone the source files of the documentation in order to have your own copy you can work on: go to the QGIS-Documentation repository page (for convenience, this repository is called below qgis/QGIS-Documentation) and click on the Fork button in the upper right corner.
Few seconds later, in your GitHub account you find a QGIS-Documentation repository (https://github.com/<YourName>/QGIS-Documentation). This repo is a safe copy in which you have full write access and can push all your contributions without a risk to affect the official documentation. At the beginning, this repository contains the same branches as qgis/QGIS-Documentation and is defaulted to master branch. Branches are parallel lines of development containing different snapshots of the doc that may merge or diverge. Preferably create a branch for each issue you want to tackle and you can create as many branches as you want.
Tip
Efectuați modificările într-o ramura dedicată acestora, niciodată în master
By convention, avoid making changes in your master branch except merging the modifications from the master branch of qgis/QGIS-Documentation (called qgis:master). And use it as model to create new branches for a clean history and snapshot.
There are different ways to contribute to QGIS documentation. Though we expose them below separately, they are not mutually exclusive, meaning that you can, at any moment, switch from one process to another without any harm because they both follow the scheme below:
Efectuați modificările într-o ramură dedicată acestora, din depozitul dvs.
Publicați modificările și cereți îmbinarea în documentația principală printr-o cerere de actualizare (PR)
From your cloned repository, you can now propose changes to the main documentation. Indeed, GitHub web interface offers you ways to easily:
editarea fișierelor, previzualizarea și efectuarea modificărilor
creare, actualizare sau ștergere ramuri
Read the GitHub Hello-world project to learn some basic vocabulary and actions that will be used below.
Documentation can be improved by addressing issues reported at https://github.com/qgis/QGIS-Documentation/issues or issues you may have encountered while browsing the doc. They can be of different types: typo error, missing feature, wrong or out of date description...
Comutați fișierul în modul de Editare cu ajutorul pictogramei creionului și efectuați următoarele modificări guidelines
The QGIS project provides an easy way to reach source file from online documentation. Indeed, instead of browsing the source files in GitHub to find the one that suits the issue, or if you find an issue while reading the manuals, you simply have to click the “Fix Me” link at the bottom of the page to open its source file in Edit mode.
Tip
If your master branch is even with qgis:master, you can safely replace in the link qgis by <YourName>. In this case, once your changes are done, you need to check Create a new branch for this commit and start a pull request and avoid modifying master.
GitHub web interface helps you update the repo with your contribution in an easier way but it doesn’t offer tools to:
You then need to install git on your hard drive in order to get access to more advanced and powerful tools and have a local copy of the repository. Some basics you may often need are exposed below. You’ll also find rules to care about even if you opt for the web interface.
În exemplele de cod de mai jos, liniile care încep cu $ prezintă comenzile pe care ar trebui să le introduceți, în timp ce # prefixează comentariile.
Acum sunteți gata pentru a obține clona dvs. a depozitului Documentației QGIS:
$ cd ~/Documents/Development/QGIS/
$ git clone git@github.com:<YourName>/QGIS-Documentation.git
The former command line is simply an example. You should adapt both the path and the repository URL, replacing <YourName> with your user name.
Tip
Permission denied (publickey) error?
If you get a Permission denied (publickey) error, there may be a problem with your SSH key. See GitHub help for details.
Rețineți:
$ git remote -v
origin git@github.com:<YourName>/QGIS-Documentation.git (fetch)
origin git@github.com:<YourName>/QGIS-Documentation.git (push)
$ git branch
* master
originea este numele depozitului dumneavoastră, accesibil de la distanță, cu Documentație QGIS.
master este ramura principală, implicită. Nu ar trebui să introduceți codul dvs. aici! Niciodată!
You can start to work here but in the long terme process you will get a lot of issue when you will push your contribution (called Pull Request in github process) as the master branch of the QGIS-Documentation repository will diverge from your local/remote repository.
Pentru a putea urmări activitatea din proiectul principal, adăugați un nou depozit, accesibil de la distanță, în depozitul local. Acest nou depozit va fi depozitul Documentației QGIS, al proiectului QGIS:
$ git remote add upstream git@github.com:qgis/QGIS-Documentation.git
$ git remote -v
origin git@github.com:<YourName>/QGIS-Documentation.git (fetch)
origin git@github.com:<YourName>/QGIS-Documentation.git (push)
upstream git@github.com:qgis/QGIS-Documentation.git (fetch)
upstream git@github.com:qgis/QGIS-Documentation.git (push)
Deci, acum aveți posibilitatea de a alege între două depozite accesibile de la distanță:
Note
upstream is just a label, a kind of standard name but you can call it as you want.
Before working on a new contribution, you should always update your local master branch in your local repository. Just run this command line:
# switch to master branch (it is easy to forget this step!)
$ git checkout master
# get "information" from the master branch in upstream repository
# (aka qgis/QGIS-Documentation's repository)
$ git fetch upstream master
# merge update from upstream/master to the current local branch
# (which should be master, see step 1)
$ git merge upstream/master
# update **your** remote repository
$ git push origin master
Now you have a local and remote repositories which have both master branch up to date with QGIS-Documentation from QGIS organisation. You can start to work on your contribution.
Along the testing documentation, we continue to fix issues in QGIS 2.14 doc, meaning that you can also contribute to it. Following the previous section sample code, you can easily do that by selecting the corresponding branch.
When you clone the repository (see Depozitul local), your clone has all the branches of the upstream repository. As above, you need to ensure your branch is up to date with the upstream’s:
# change branch e.g. for 2.14 LTR
$ git checkout manual_en_2.14
# get "information" from the manual_en_2.14 branch in upstream repository
$ git fetch upstream manual_en_2.14
# merge update from upstream/manual_en_2.14 to the current local branch
$ git merge upstream/manual_en_2.14
# update **your** remote repository
$ git push origin manual_en_2.14
In this way your local and remote branches for the 2.14 version are up to date with the one of the official upstream repository.
Now that your base branch is updated, you need to create a dedicated branch in which you add your contribution. Always work on a branch other than the base branch! Always!
$ git checkout -b myNewBranch
# checkout means go to the branch
# and -b flag creates a new branch if needed, based on current branch
$ git branch
master
manual_en_2.14
* myNewBranch
# a list of existing branch where * means the current branch
# You can now add your contribution, by editing the concerned file
# with any application (in this case, vim is used)
$ vim myFile
# once done
$ git add myFile
$ git commit
Few words about commit/push commands:
Now that your changes are saved and committed in your local branch, you need to send them to your remote repository in order to create pull request:
$ git push origin myNewBranch
După ce PR-ul a fost încorporat în Documentația QGIS oficială, puteți șterge ramura. În cazul în care lucrați mult în acest mod, în câteva săptămâni, vă veți alege cu o mulțime de ramuri nefolositoare. De aceea, pentru a păstra curat depozitul curățați-l în acest fel:
# delete local branch
$ git branch -d myNewBranch
# Remove your remote myNewBranch by pushing nothing to it
$ git push origin :myNewBranch
Și nu uitați să actualizați ramura master din depozit local!