backup de julho
[h2N7SspZmY.git] / data / cache / 4 / 4c8e8a5a6f17f6a5b332234a67ddef83.xhtml
blob2de1a5469e98410e04e4f925242288b295d0b9f6
4 <h1><a name="git" id="git">Git</a></h1>
5 <div class="level1">
7 <p>
9 <a href="http://git-scm.com/" class="urlextern" title="http://git-scm.com/" rel="nofollow">Git</a>: <a href="http://en.wikipedia.org/wiki/Git_(software)" class="interwiki iw_wp" title="http://en.wikipedia.org/wiki/Git_(software)">Git</a> <br/>
11 </p>
12 <div class="plugin_uparrow">
13 <a href="#" title="Back to top">
14 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
15 </a>
16 </div>
18 </div>
19 <!-- SECTION "Git" [1-78] -->
20 <h2><a name="how_to_install_git" id="how_to_install_git">How to install Git</a></h2>
21 <div class="level2">
22 <pre class="code bash">$ <span class="kw2">sudo</span> <span class="kw2">apt-get</span> <span class="kw2">install</span> git-core
23 $ git config <span class="re5">--global</span> user.name user_name
24 $ git config <span class="re5">--global</span> user.email you<span class="sy0">@</span>yourdomain.example.com</pre>
25 <div class="plugin_uparrow">
26 <a href="#" title="Back to top">
27 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
28 </a>
29 </div>
31 </div>
32 <!-- SECTION "How to install Git" [79-264] -->
33 <h2><a name="how_to_create_a_ssh_key" id="how_to_create_a_ssh_key">How to create a SSH key</a></h2>
34 <div class="level2">
35 <pre class="code bash">$ <span class="kw2">ssh-keygen</span></pre>
36 <div class="plugin_uparrow">
37 <a href="#" title="Back to top">
38 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
39 </a>
40 </div>
42 </div>
43 <!-- SECTION "How to create a SSH key" [265-336] -->
44 <h2><a name="how_to_create_a_project" id="how_to_create_a_project">How to create a project</a></h2>
45 <div class="level2">
47 <p>
49 Using <a href="http://repo.or.cz" class="urlextern" title="http://repo.or.cz" rel="nofollow">Repo Public Git Hosting</a>
50 </p>
51 <pre class="code bash">$ <span class="kw3">cd</span> path<span class="sy0">/</span>to<span class="sy0">/</span>project
52 $ git init
53 $ git add .
54 $ git commit <span class="re5">-a</span> <span class="re5">-m</span><span class="st0">&quot;message&quot;</span>
55 $ git remote add origin <span class="kw2">ssh</span>:<span class="sy0">//</span>user_name<span class="sy0">@</span>repo.or.cz<span class="sy0">/</span>srv<span class="sy0">/</span>git<span class="sy0">/</span>project_name.git
56 $ git push <span class="re5">--all</span> origin</pre>
58 <p>
59 Using <a href="https://github.com/" class="urlextern" title="https://github.com/" rel="nofollow">GitHub</a>
60 </p>
61 <pre class="code bash">$ <span class="kw2">mkdir</span> project_name
62 $ <span class="kw3">cd</span> project_name
63 $ git init
64 $ <span class="kw2">touch</span> README
65 $ git add README
66 $ git commit <span class="re5">-m</span> <span class="st_h">'first commit'</span>
67 $ git remote add origin git<span class="sy0">@</span>github.com:user_name<span class="sy0">/</span>project_name.git
68 $ git push origin master</pre>
69 <div class="plugin_uparrow">
70 <a href="#" title="Back to top">
71 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
72 </a>
73 </div>
75 </div>
76 <!-- SECTION "How to create a project" [337-882] -->
77 <h2><a name="how_to_download_a_project" id="how_to_download_a_project">How to download a project</a></h2>
78 <div class="level2">
80 <p>
82 Using <a href="http://repo.or.cz" class="urlextern" title="http://repo.or.cz" rel="nofollow">Repo Public Git Hosting</a>
83 </p>
84 <pre class="code bash">$ git clone git:<span class="sy0">//</span>repo.or.cz<span class="sy0">/</span>project_name.git
85 $ <span class="kw3">cd</span> project_name</pre>
87 <p>
88 Using <a href="https://github.com/" class="urlextern" title="https://github.com/" rel="nofollow">GitHub</a>
89 </p>
90 <pre class="code bash">$ git clone http:<span class="sy0">//</span>github.com<span class="sy0">/</span>user_name<span class="sy0">/</span>project_name.git
91 $ <span class="kw3">cd</span> project_name</pre>
92 <div class="plugin_uparrow">
93 <a href="#" title="Back to top">
94 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
95 </a>
96 </div>
98 </div>
99 <!-- SECTION "How to download a project" [883-1193] -->
100 <h2><a name="how_to_upload_a_project" id="how_to_upload_a_project">How to upload a project</a></h2>
101 <div class="level2">
105 Just the first time:
106 </p>
109 Using <a href="http://repo.or.cz" class="urlextern" title="http://repo.or.cz" rel="nofollow">Repo Public Git Hosting</a>
110 </p>
111 <pre class="code bash">$ git remote <span class="kw2">rm</span> origin
112 $ git remote add origin <span class="kw2">ssh</span>:<span class="sy0">//</span>user_name<span class="sy0">@</span>repo.or.cz<span class="sy0">/</span>srv<span class="sy0">/</span>git<span class="sy0">/</span>project_name.git</pre>
115 Using <a href="https://github.com/" class="urlextern" title="https://github.com/" rel="nofollow">GitHub</a>
116 </p>
117 <pre class="code bash">$ git remote <span class="kw2">rm</span> origin
118 $ git remote add origin git<span class="sy0">@</span>github.com:user_name<span class="sy0">/</span>project_name.git</pre>
121 Always:
123 </p>
124 <pre class="code bash">$ git add .
125 $ git commit <span class="re5">-a</span> <span class="re5">-m</span><span class="st0">&quot;description of the modifications&quot;</span>
126 $ git push <span class="re5">--all</span> origin</pre>
127 <div class="plugin_uparrow">
128 <a href="#" title="Back to top">
129 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
130 </a>
131 </div>
133 </div>
134 <!-- SECTION "How to upload a project" [1194-1691] -->
135 <h2><a name="how_to_update_your_version_of_a_project" id="how_to_update_your_version_of_a_project">How to update your version of a project</a></h2>
136 <div class="level2">
137 <pre class="code bash">$ git pull origin master</pre>
138 <div class="plugin_uparrow">
139 <a href="#" title="Back to top">
140 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
141 </a>
142 </div>
144 </div>
145 <!-- SECTION "How to update your version of a project" [1692-1792] -->
146 <h2><a name="how_to_create_a_tag" id="how_to_create_a_tag">How to create a tag</a></h2>
147 <div class="level2">
148 <pre class="code bash">$ git tag tag_name</pre>
149 <div class="plugin_uparrow">
150 <a href="#" title="Back to top">
151 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
152 </a>
153 </div>
155 </div>
156 <!-- SECTION "How to create a tag" [1793-1865] -->
157 <h2><a name="how_to_upload_a_tag" id="how_to_upload_a_tag">How to upload a tag</a></h2>
158 <div class="level2">
159 <pre class="code bash">$ git push origin tag_name</pre>
163 </p>
164 <pre class="code bash">$ git push <span class="re5">--tags</span> origin</pre>
165 <div class="plugin_uparrow">
166 <a href="#" title="Back to top">
167 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
168 </a>
169 </div>
171 </div>
172 <!-- SECTION "How to upload a tag" [1866-1996] -->
173 <h2><a name="git_cheat_sheet" id="git_cheat_sheet">Git Cheat Sheet</a></h2>
174 <div class="level2">
178 <a href="http://cheat.errtheblog.com/s/git?utm_source=twitter&amp;utm_medium=micro-blog&amp;utm_campaign=twitter" class="urlextern" title="http://cheat.errtheblog.com/s/git?utm_source=twitter&amp;utm_medium=micro-blog&amp;utm_campaign=twitter" rel="nofollow">Cheat Git</a>
179 </p>
180 <div class="plugin_uparrow">
181 <a href="#" title="Back to top">
182 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
183 </a>
184 </div>
186 </div>
187 <!-- SECTION "Git Cheat Sheet" [1997-2136] -->
188 <h2><a name="resumo_em_portugues" id="resumo_em_portugues">Resumo em português</a></h2>
189 <div class="level2">
190 <pre class="code bash">Tens que te cadastrar no github e me dizer teu usuário para poderes dar pull
191 &nbsp;
192 http:<span class="sy0">//</span>github.com<span class="sy0">/</span>kssilveira<span class="sy0">/</span>CTipsAndTricks
193 &nbsp;
194 chave <span class="kw2">ssh</span>:
195 <span class="kw2">cat</span> ~<span class="sy0">/</span>.ssh<span class="sy0">/</span>id_rsa.pub
196 caso o arquivo exista, coloca o conteú<span class="kw1">do</span> dele na tua lista de chaves <span class="kw2">ssh</span> no teu perfil <span class="kw1">do</span> git hub
197 caso não exista:
198 <span class="kw2">ssh-keygen</span>
199 <span class="br0">&#123;</span>enter<span class="br0">&#125;</span>
200 escolhe uma senha
201 goto chave <span class="kw2">ssh</span>
202 &nbsp;
203 git config <span class="re5">--global</span> user.name <span class="st0">&quot;Bruno Jurkovski&quot;</span>
204 git config <span class="re5">--global</span> user.email bjurkovski<span class="sy0">@</span>gmail.com
205 git clone git<span class="sy0">@</span>github.com:kssilveira<span class="sy0">/</span>CTipsAndTricks.git
206 ... edita ...
207 git status
208 ... <span class="kw2">make</span> clean nas pastas com os slides ... apagar <span class="sy0">*</span>~, <span class="sy0">*</span>.o, executáveis e etc. de todas <span class="kw2">as</span> pastas ...
209 git status
210 ... ver se tem apenas arquivos que não são derivados <span class="br0">&#40;</span>além dos pdfs<span class="br0">&#41;</span> ...
211 git add .
212 git status
213 ... verificar novamente ...
214 git commit <span class="re5">-a</span> <span class="re5">-m</span><span class="st0">&quot;descrição&quot;</span>
215 ... isso cria uma versão <span class="kw3">local</span> <span class="br0">&#40;</span>só na tua máquina<span class="br0">&#41;</span>, que funciona da mesma forma que se tivesse no servidor ...
216 git push <span class="re5">--all</span> origin
217 ... upload para o servidor ...
218 git pull origin master
219 ... download <span class="kw1">do</span> servidor ...</pre>
220 <div class="tags"><span>
221 <a href="/~kssilveira/site/doku.php?id=tag:programming&amp;do=showtag&amp;tag=tag%3Aprogramming" class="wikilink1" title="tag:programming" rel="tag">programming</a>
222 </span></div>
223 <div class="plugin_uparrow">
224 <a href="#" title="Back to top">
225 <img src="lib/plugins/uparrow/images/tango-small.png" alt="Back to top"/>
226 </a>
227 </div>
229 </div>
230 <!-- SECTION "Resumo em português" [2137-] -->