<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mauricio de Amorim &#187; branch</title>
	<atom:link href="http://mauriciodeamorim.com.br/tag/branch/feed/" rel="self" type="application/rss+xml" />
	<link>http://mauriciodeamorim.com.br</link>
	<description>Tecnologia e desenvolvimento web</description>
	<lastBuildDate>Tue, 21 Feb 2012 22:09:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Manipulando branches remotos com Git</title>
		<link>http://mauriciodeamorim.com.br/2010/07/12/manipulando-branches-remotos-git/</link>
		<comments>http://mauriciodeamorim.com.br/2010/07/12/manipulando-branches-remotos-git/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 04:51:14 +0000</pubDate>
		<dc:creator>Mauricio de Amorim</dc:creator>
				<category><![CDATA[Dicas rápidas]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[GitHub]]></category>

		<guid isPermaLink="false">http://mauriciodeamorim.com.br/?p=707</guid>
		<description><![CDATA[Reorganizando meus projetos no Github me deparei com o problema de ter criado muitos branches locais e remotos e tudo estava uma grande bagunça. Os comandos que me ajudaram a resolver isto foram: Dado os branches locais macos-snow ~/project (master) git branch * master fix_counter rails3-version Para criá-los remotamente use macos-snow ~/project (master) git push [...]]]></description>
			<content:encoded><![CDATA[<p>Reorganizando meus projetos no <a href="http://github.com" target="_blank">Github</a> me deparei com o problema de ter criado muitos branches locais e remotos e tudo estava uma grande bagunça. Os comandos que me ajudaram a resolver isto foram:</p>
<p>Dado os branches locais </p>
<pre style="background-color: black; color: white">
macos-snow <span style="color: green">~/project</span><span style="color:red"> (master)</span> git branch
* master
  fix_counter
  rails3-version
</pre>
<p>Para criá-los remotamente use</p>
<pre style="background-color: black; color: white">
macos-snow <span style="color: green">~/project</span><span style="color:red"> (master)</span> git push --all
</pre>
<p>Ou para um branch específico</p>
<pre style="background-color: black; color: white">
macos-snow <span style="color: green">~/project</span><span style="color:red"> (master)</span> git push origin rails3-version
</pre>
<p>Para apagar branches locais</p>
<pre style="background-color: black; color: white">
macos-snow <span style="color: green">~/project</span><span style="color:red"> (master)</span> git branch -D rails3-version
</pre>
<p>Para apagar branches remotos</p>
<pre style="background-color: black; color: white">
macos-snow <span style="color: green">~/project</span><span style="color:red"> (master)</span> git push origin :rails3-version
</pre>
<p>Renomear branches locais</p>
<pre style="background-color: black; color: white">
macos-snow <span style="color: green">~/project</span><span style="color:red"> (master)</span> git branch -m old_branch new_branch
</pre>
<p>As referências que encontrei para renomear branches remotos não me foram úteis por isso fiz da forma mais prática renomeando o branch local, enviando para repositório e apagando o branch remoto antigo.</p>
<p><b>Referências:</b><br />
- <a href="http://help.github.com/remotes/" target="_blank">Help Github</a><br />
- <a href="http://www.gitready.com" target="_blank">Git ready</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mauriciodeamorim.com.br/2010/07/12/manipulando-branches-remotos-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diferenças entre comandos básicos Git e SVN</title>
		<link>http://mauriciodeamorim.com.br/2009/02/01/diferencas-entre-comandos-basicos-git-e-svn/</link>
		<comments>http://mauriciodeamorim.com.br/2009/02/01/diferencas-entre-comandos-basicos-git-e-svn/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 00:39:26 +0000</pubDate>
		<dc:creator>Mauricio de Amorim</dc:creator>
				<category><![CDATA[Dicas]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://mauriciodeamorim.com.br/?p=104</guid>
		<description><![CDATA[Introdução O que é Git? Sistema de controle de versão distribuído onde não temos um repositório central e cada cópia do projeto principal torna-se um repositório local ou remoto. O que é branch? É uma ramificação do projeto principal. Quando inicializamos um projeto com Git temos um branch origin que mantem uma cópia do projeto [...]]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: underline;"><strong>Introdução</strong></span></p>
<p><strong>O que é Git?</strong><br />
Sistema de controle de versão distribuído onde não temos um repositório central e cada cópia do projeto principal torna-se um repositório local ou remoto.<br />
<strong><br />
O que é branch?</strong><span id="more-104"></span><br />
É uma ramificação do projeto principal. Quando inicializamos um projeto com Git temos um branch <em><strong>origin</strong></em> que mantem uma cópia do projeto original e um branch <em><strong>master</strong></em> que é o branch padrão  a partir de onde criaremos nossos branches para desenvolvimento.</p>
<p><strong>Pode haver mais de um branch por desenvolvedor?</strong><br />
Não há limites para criação branches e cada branch pode até torna-se um outro projeto ou ter correções e desenvolvimento de novas características paralelamente.  Por exemplo, após obter os arquivos de um determinado projeto para o branch <em><strong>master</strong></em> podemos criar um branch <strong><em>working</em></strong> para desenvolvermos determinadas tarefas e ao mesmo criar um branch <strong><em>fix</em></strong> para corrigir uma falha encontrada em um desenvolvimento anterior sem que uma alteração interfira em outra.  Cada branch terá seus &#8220;commits&#8221; individuais a qualquer tempo.</p>
<p><strong>Como manteremos os branches sincronizados então?</strong><br />
Ao fazer commit no branch  <strong><em>fix </em></strong>mesclamos (merge) as atualizações com o branch <em><strong>master</strong></em> e a partir daí fazemos uma atualização (rebase) do  branch <strong><em>working</em></strong> com as correções executadas no branch <em><strong>master</strong></em>.  Logicamente podem haver conflitos que deverão ser tratados nesta ocasião.</p>
<p><strong>O que é trunk?</strong><br />
É repositório principal no SVN ou a linha principalmente de desenvolvimento, no Git tudo é tratado como branch e neste caso é o branch <em><strong>master</strong></em>.</p>
<p>Comparação entre os comandos básicos do Git e SVN:</p>
<table style="text-align: left; height: 252px;" border="0" cellspacing="0" cellpadding="0" width="600">
<col style="width: 70pt;" width="70"></col>
<col style="width: 180pt;" width="180"></col>
<tbody>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt; width: 110pt;" width="147" height="20">git   clone <em>url</em></td>
<td class="xl24" style="width: 110pt;" width="147">svn checkout <em>url</em></td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt;" height="20">git pull</td>
<td class="xl24">svn update</td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt; width: 110pt;" width="147" height="20">git init-db</td>
<td class="xl24" style="width: 77pt;" width="102">svnadmin create   <em>repo</em></td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt;" height="20">git diff</td>
<td class="xl24">svn diff</td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt; width: 110pt;" width="147" height="20">git status</td>
<td class="xl24" style="width: 77pt;" width="102">svn status</td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt;" height="20">git checkout <em>path</em></td>
<td class="xl24">svn revert <em>path</em></td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt; width: 110pt;" width="147" height="20">git add <em>file</em></td>
<td class="xl24" style="width: 77pt;" width="102">svn add <em>file</em></td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt;" height="20">git commit -a</td>
<td class="xl24">svn commit</td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt;" height="20">git branch <em>branch</em></td>
<td class="xl24">svn copy http://example.com/svn/trunk       http://example.com/svn/branches/<em>branch</em></td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt;" height="20">git checkout <em>branch</em></td>
<td class="xl24">svn switch       http://example.com/svn/branches/<em>branch</em></td>
</tr>
<tr style="height: 15pt;" height="20">
<td class="xl24" style="height: 15pt;" height="20">git branch</td>
<td class="xl24">svn list http://example.com/svn/branches/</td>
</tr>
</tbody>
</table>
<p><strong>Referências:</strong><br />
- <a href="http://git.or.cz/course/svn.html">Git &#8211; SVN Crash Course</a><br />
- <a href="http://tsunanet.blogspot.com/2007/07/learning-git-svn-in-5min.html" target="_blank">Learning git-svn in 5min</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mauriciodeamorim.com.br/2009/02/01/diferencas-entre-comandos-basicos-git-e-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Criando branches no Git</title>
		<link>http://mauriciodeamorim.com.br/2009/01/09/criando-branches-no-git/</link>
		<comments>http://mauriciodeamorim.com.br/2009/01/09/criando-branches-no-git/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 00:21:03 +0000</pubDate>
		<dc:creator>Mauricio de Amorim</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://mauriciodeamorim.com.br/blog/?p=13</guid>
		<description><![CDATA[0) Instale e configure o Git. 1) No GitHub encontre o Clone URL do projeto. 2) Pelo terminal (Git Bash) entre na pasta onde será criado o projeto (Ex.: C:\projetos) e digite: git clone git://github.com/nome_usuario_github/nome_projeto.git 3) Entre na nova pasta adicionada e crie um branch chamado working: cd nome_projeto git branch working master 4) Alterne [...]]]></description>
			<content:encoded><![CDATA[<p>0) <a title="Instalação do Git no Windows" href="http://mauriciodeamorim.com.br/2009/01/06/como-usar-git-no-windows/" target="_blank">Instale e configure o Git.</a></p>
<p>1) No GitHub encontre o <em><strong>Clone URL</strong></em> do projeto.</p>
<p>2) Pelo terminal (Git Bash) entre na pasta onde será criado o projeto (Ex.: C:\projetos) e digite:</p>
<pre><code>git clone git://github.com/nome_usuario_github/nome_projeto.git</code></pre>
<p>3) Entre na nova pasta adicionada e crie um branch chamado <em><strong>working</strong></em>:</p>
<pre><code>cd nome_projeto
git branch working master</code></pre>
<p>4) Alterne para o branch <em><strong>working</strong></em>:</p>
<pre><code>git checkout working</code></pre>
<p>5) O branch onde estamos aparecerá com asterisco ao digitar:</p>
<pre><code>git branch
  master
* working </code></pre>
<p>6) Crie um arquivo e adicione ao branch:</p>
<pre><code>touch README.txt</code></pre>
<pre><code>git add README.txt</code></pre>
<p>ou</p>
<pre><code>git add .</code></pre>
<p>ou</p>
<pre><code>git add -i</code></pre>
<p>- O primeiro adiciona o arquivo especificado, lembrando que README.txt é diferente de readme.txt.<br />
- O segundo adiciona todos os arquivos modificados, excluídos ou incluídos.<br />
- O terceiro adiciona interativamente(i). Uma lista será exibida para que cada arquivo seja incluído individualmente.</p>
<p>7) Faça o commit das alterações (ainda estamos no branch <em>working</em>) e depois liste os arquivos para ver o que temos:</p>
<pre><code>git commit -m "Primeiro commit no branch working"
ls -la</code></pre>
<p>8 ) Agora volte para o branch <em>master</em> e liste os arquivos:</p>
<pre><code>git checkout master
ls -la</code></pre>
<p>O arquivo README.txt não foi listado. Ele existe apenas no branch <em><strong>working</strong></em>, ou seja, o código original continua intacto.</p>
<p>É possível criar diversos branches e trabalhar uma parte do código em cada um deles sem alterar o branch original e depois juntá-los gradativamente assim que cada alteração fique pronta.</p>
<p><a href="http://ktown.kde.org/~zrusin/git/git-cheat-sheet-medium.png">Consulta rápida dos comandos e fluxo do Git (Cheat Sheet)</a></p>
<p><strong>Referências:</strong><br />
- <a href="http://br.kernelnewbies.org/node/58" target="_blank">Guia rápido para o GIT</a><br />
- <a href="http://www.akitaonrails.com/2008/4/3/micro-tutorial-de-git">Micro Tutorial de Git</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mauriciodeamorim.com.br/2009/01/09/criando-branches-no-git/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

