Bom dia a todos,<div><br></div><div>Depois de algumas lutas com o git (que é muito útil mas também algo confuso), decidi escrever uma cábula como o "melhor" workflow para contribuir para o projectos no github, neste caso adaptado à tradução do QGIS. É um pouco extenso mas no final há uma cábula com os comandos mais repetitivos.</div>
<div><br></div><div>Espero que seja útil a quem se quiser aventurar por esta via.</div><div><br></div><div>Alexandre Neto</div><div><br></div><div><br></div><div><strong style="color:rgb(34,34,34);line-height:1.428571em"><span style="line-height:1.428571em"><font face="courier new, monospace"><u>INSTALAR GIT</u></font></span></strong></div>
<div><div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px"><span style="font-size:small;line-height:1.428571em"><span style="line-height:1.428571em"><b><font face="courier new, monospace">Windows</font></b></span></span></div>
<div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px"><font face="courier new, monospace"><span style="font-size:small;line-height:1.428571em"><span style="line-height:1.428571em">Fazer download<b> </b><a href="http://git-scm.com/download/win">aqui</a> </span></span>e instalar o exe.</font></div>
<div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px"><font face="courier new, monospace">Depois de instalado, usa-se o atalho "git Bash" para abrir uma consola.</font></div>
<div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px"><font face="courier new, monospace"><br></font></div><div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px">
<b><font face="courier new, monospace">Linux</font></b></div><div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px"><font face="courier new, monospace">Abrir uma consola e fazer</font></div>
<div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px"><font face="courier new, monospace">    </font></div><div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px">
<font face="courier new, monospace">    sudo apt-get install git</font></div><div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px"><strong style="font-size:small;line-height:1.428571em"><span style="line-height:1.428571em"><font face="courier new, monospace"><br>
</font></span></strong></div><div style="color:rgb(34,34,34);background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;line-height:1.428571em;font-size:14px"><strong style="font-size:small;line-height:1.428571em"><span style="line-height:1.428571em"><font face="courier new, monospace"><u>CONFIGURAR</u></font></span></strong></div>
<div style="color:rgb(34,34,34);font-size:13px;background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px"><div style="font-size:14px;line-height:1.428571em;margin:0px;padding:0px;border:0px"><strong style="line-height:1.428571em"><span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace">1. Criar uma conta em GitHub.com e aceder à mesma;</font></span></strong></div>
<div style="font-size:14px;line-height:1.428571em;margin:0px;padding:0px;border:0px"><strong style="line-height:1.428571em"><span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace">2. Procurar "Quantum-GIS" na pesquisa;</font></span></strong></div>
<div style="font-size:14px;line-height:1.428571em;margin:0px;padding:0px;border:0px"><strong style="line-height:1.428571em"><span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace">2. Criar um fork do Quantum-GIS na tua conta (canto superior direito);</font></span></strong></div>
<div style="font-size:14px;line-height:1.428571em;margin:0px;padding:0px;border:0px"><strong style="line-height:1.428571em"><span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace">3. Obter cópia local dos ficheiros do fork criado:</font></span></strong></div>
<div style="font-size:14px;line-height:1.428571em;margin:0px;padding:0px;border:0px"><font face="courier new, monospace"><br clear="none"></font></div><div style="font-size:14px;line-height:1.428571em;margin:0px;padding:0px;border:0px">
<span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace">Para copiar os todos os ficheiro para o computador local executar o seguinte comando git na consola:</font></span></div><div style="font-size:14px;line-height:1.428571em;margin:0px;padding:0px;border:0px">
<font face="courier new, monospace"><br clear="none"></font></div><div style="font-size:14px;line-height:1.428571em;margin:0px;padding:0px;border:0px"><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em">
<span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace"><span style="line-height:1.428571em;color:rgb(255,0,0)">    git clone <a href="https://github.com/" target="_blank" style="color:rgb(17,85,204)">https://github.com/</a><em style="margin:0px;padding:0px;border:0px;line-height:1.428571em">username</em>/Quantum-GIS.git</span><br clear="none">

<br clear="none"></font></span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace">Nesta fase, será criada uma pasta Quantum-GIS, com uma cópia local do teu repositório, com uma ligação remota ao fork pessoal, ao que o git dá o nome de "origin", e para onde podemos mais tarde enviar alterações realizadas.</font></span></pre>
<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace"><br clear="none">
<strong style="line-height:1.428571em">4. configurar o repositório original</strong><br clear="none"><br clear="none">Para se actualizar os ficheiros locais e remotos em relação ao repositório "oficial" do QGIS (onde outras pessoas deram os seus contributos) é necessário configurar a localização do mesmo, chamando-lhe "upstream", já dentro da recém criada pasta "Quantum-GIS" fazemos:<br clear="none">

<br clear="none"></font></span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace"><span style="line-height:1.428571em;color:rgb(255,0,0)">    git remote add upstream </span><a shape="rect" href="https://github.com/qgis/Quantum-GIS.git" target="_blank" style="color:rgb(4,122,198);margin:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em;color:rgb(255,0,0)">https://github.com/qgis/Quantum-GIS.git</span><br clear="none">

<br clear="none"></a><span style="line-height:1.428571em;text-decoration:underline"><strong style="line-height:1.428571em">ROTINA HABITUAL PARA EFECTUAR ALTERAÇÕES</strong></span></font></span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em">
<span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace"><br clear="none"><strong style="line-height:1.428571em">1. Actualizar ficheiros em relação ao origin (github pessoal)</strong><br clear="none">
<br clear="none">NOTA: Este passo só é necessário caso se usar mais do que um computador (ou mais que uma pessoa usem o mesmo fork) para fazer alterações, caso contrário a sua cópia local estará sempre mais actual ou igual ao "origin". Para actualizar os ficheiros locais em relação ao repositório pessoal remoto "origin":<br clear="none">

<span style="line-height:1.428571em;color:rgb(255,0,0)">    git pull origin<br clear="none"><br clear="none"></span>Que irá buscar todas as alterações que foram entretanto enviadas (de outro computador) para o repositório pessoal remoto no github.<br clear="none">

<br clear="none"><span style="line-height:1.428571em"><strong style="line-height:1.428571em">2. Actualizar os ficheiros em relação ao upstream</strong><br clear="none"><br clear="none"></span>Para manter o seu fork actualizado, de cada vez que se pretender fazer alterações aos ficheiros, convém verificar antes se houve alterações no repositório original do Quantum-GIS (o "upstream"):<br clear="none">

<span style="line-height:1.428571em;color:rgb(255,0,0)">    git pull --rebase upstream master</span><br clear="none"><br clear="none"></font></span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em">
<span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace">Tendo havido alterações no upstream, a cópia local é actualizada, e as alterações integradas nos seus ficheiros. (Nota: por causa do --rebase qualquer alteração que já tenha sido feita por si, é colocada no topo das alterações feitas por outros)<br clear="none">

<br clear="none"><strong style="line-height:1.428571em">3. Efectuar alterações ao ficheiros que desejar<br clear="none"></strong><br clear="none">(No caso das traduções editando e gravando o ficheiro Quantum-GIS/i18n/qgis_pt_PT.ts com o QtLinguist)<br clear="none">

<strong style="line-height:1.428571em"><br clear="none">4. registar as alterações feitas</strong><br clear="none"><br clear="none">Depois de feitas alterações, gravamos o seu estado através do comando commit:<br clear="none">

<br clear="none"><span style="line-height:1.428571em;color:rgb(255,0,0)">    git commit -ma "comentário sobre as alterações"<br clear="none"><br clear="none"><span style="line-height:1.428571em;color:rgb(0,0,0)">NOTA: cada commit representa um "ponto de restauro" ao qual podemos voltar atrás em caso detectarmos algum problema.</span><br clear="none">

<br clear="none"></span><strong style="line-height:1.428571em">5. Arrumar a casa<br clear="none"><br clear="none">Para "arrumar" os nossos repositórios pessoais (locais e remotos), antes de fazer o pull request, podemos voltar a fazer um pull --rebase com o upstream, para colocar as nossas alterações por cima de qualquer coisa que tenha sido entretanto feita.<br clear="none">

<br clear="none"></strong></font></span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em;font-size:small;color:rgb(255,0,0)"><font face="courier new, monospace">    git pull --rebase upstream master</font></span></pre>
<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace"><strong style="line-height:1.428571em"><br clear="none">

6. Enviar as alterações para o seu repositório pessoal remoto</strong><br clear="none"><br clear="none">Depois de efectuadas alterações depois de feito o commit, podemos enviá-los para o nosso repositório pessoal (o fork criado anteriormente):<br clear="none">

<br clear="none"></font></span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em;font-size:small;color:rgb(255,0,0)"><font face="courier new, monospace">    git push origin master</font></span></pre>
<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em"><font face="courier new, monospace"><br clear="none"><strong style="line-height:1.428571em"><span style="line-height:1.428571em;font-size:small"><u>SUBMETER ALTERAÇÕES AO PROJECTO OFICIAL</u><br clear="none">

</span></strong><span style="line-height:1.428571em;font-size:small">Satisfeitos com o nosso trabalho e achando que o conjunto de alterações feitas será de valor para o projecto, solicitamos a integração do mesmo no repositório oficial através de um pull request. </span></font></span></pre>
<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em"><font face="courier new, monospace"><span style="line-height:1.428571em;font-size:small">O pull request é feito na conta do Github criada no site, no fork pessoal criado, através do botão Pull request que está no topo da página. Depois de enviado é aguardar que alguém com direitos de escrita no projecto QGIS aceite as alterações.</span></font></span></pre>
<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em"><font face="courier new, monospace"><span style="line-height:1.428571em;font-size:small"><br>
</span></font></span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><span style="line-height:1.428571em"><font face="courier new, monospace"><span style="line-height:1.428571em;font-size:small"><u><b>CÁBULA</b></u></span></font></span></pre>
<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em"><pre style="line-height:1.428571em;white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px">
<span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace"><span style="line-height:1.428571em;color:rgb(255,0,0)">*   git pull origin</span></font></span></pre><pre style="line-height:1.428571em;white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px">
<span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace"><span style="line-height:1.428571em;color:rgb(255,0,0)">    git pull --rebase upstream master</span></font></span></pre><pre style="line-height:1.428571em;white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px">
<span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace"><span style="line-height:1.428571em;color:rgb(255,0,0)">--> Efectuar alterações <--</span></font></span></pre><pre style="line-height:1.428571em;white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px">
<span style="color:rgb(255,0,0);line-height:1.428571em;font-family:'courier new',monospace;font-size:small">    git commit -ma "comentário"</span></pre><pre style="line-height:1.428571em;white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px">
<span style="line-height:1.428571em;font-size:small"><font face="courier new, monospace"><span style="line-height:1.428571em;color:rgb(255,0,0)">    git pull --rebase upstream master</span></font></span></pre><pre style="line-height:1.428571em;white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px">
<span style="line-height:1.428571em;font-size:small;color:rgb(255,0,0)"><font face="courier new, monospace">    git push origin master</font></span></pre></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em">
<span style="line-height:1.428571em"><font face="courier new, monospace"><span style="line-height:1.428571em;font-size:small"><br></span></font></span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em">
<span style="line-height:1.428571em"><font face="courier new, monospace"><span style="line-height:1.428571em;font-size:small"><br></span></font></span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:1.428571em">
<span style="font-family:arial;font-size:small;line-height:normal;background-color:transparent">2013/5/22 Luís de Sousa </span><span dir="ltr" style="font-family:arial;font-size:small;line-height:normal;background-color:transparent"><<a href="mailto:luis.a.de.sousa@gmail.com" target="_blank">luis.a.de.sousa@gmail.com</a>></span></pre>
</div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Giovanni, só para confirmar que é este o ficheiro:</div><div><br>
</div><a href="https://github.com/qgis/Quantum-GIS/blob/master/i18n/qgis_pt_PT.ts" target="_blank">https://github.com/qgis/Quantum-GIS/blob/master/i18n/qgis_pt_PT.ts</a><br>
<div><br></div><div>Ainda indica a versão 1.8. Abraço,</div><div><br></div><div>Luís</div></div>
<br>_______________________________________________<br>
Portugal mailing list<br>
<a href="mailto:Portugal@lists.osgeo.org">Portugal@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/portugal" target="_blank">http://lists.osgeo.org/mailman/listinfo/portugal</a><br>
<br></blockquote></div><br></div>