2018-11-13 08:54:50 +00:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
category-page: intermediate
|
2018-11-16 12:47:48 +00:00
|
|
|
category-title: Intermediate commands
|
|
|
|
tags: versioning commit merge software source code
|
2018-11-13 08:54:50 +00:00
|
|
|
author: Andrea Brites Marto
|
|
|
|
title: git
|
|
|
|
---
|
2018-11-16 19:47:01 +00:00
|
|
|
If you want to use <i>Git</i> on the shell you need to know how this command works.<br>
|
|
|
|
The <i>git</i> command providesa set of high-level operations and full access to internals.<br>
|
2018-11-14 21:15:38 +00:00
|
|
|
|
2018-11-16 19:47:01 +00:00
|
|
|
Here is the basic syntax but commands may become some more complicated:
|
2018-11-14 21:15:38 +00:00
|
|
|
|
|
|
|
<pre>
|
2018-11-16 19:47:01 +00:00
|
|
|
git [flags] [path]
|
2018-11-14 21:15:38 +00:00
|
|
|
</pre>
|
|
|
|
|
2018-11-16 19:47:01 +00:00
|
|
|
<h3>Start a working environment</h3>
|
2018-11-14 21:15:38 +00:00
|
|
|
|
|
|
|
<ul>
|
2018-11-16 19:47:01 +00:00
|
|
|
<li><b>clone</b>: is used to clone a repository in a new directory.</li>
|
|
|
|
<li><b>init</b>: this onw is used to create an empty Git repository or reinitialize
|
|
|
|
an existing one.
|
|
|
|
</li>
|
2018-11-14 21:15:38 +00:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<h3>Work on the current changes</h3>
|
|
|
|
<ul>
|
2018-11-16 19:47:01 +00:00
|
|
|
<li><b>add</b>: add a file contents to the index.</li>
|
|
|
|
<li><b>mv</b>: move or renamea file, directory or a symlink (a symbolic link).</li>
|
|
|
|
<li><b>rm</b>: remove files from the working tree and from the index.</li>
|
|
|
|
<li><b>format-patch id</b>: create a file patch</li>
|
|
|
|
<li><b>am</b>: apply a patch file</li>
|
2018-11-14 21:15:38 +00:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<h3>History and state</h3>
|
|
|
|
<ul>
|
2018-11-16 19:47:01 +00:00
|
|
|
<li><b>log</b>: show commit logs.</li>
|
|
|
|
<li><b>status</b>: show the working tree status.</li>
|
2018-11-14 21:15:38 +00:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<h3>Managing modification</h3>
|
|
|
|
<ul>
|
2018-11-16 19:47:01 +00:00
|
|
|
<li><b>commit</b>: record changes to the repository.</li>
|
|
|
|
<li><b>diff</b>: show changes between commits.</li>
|
|
|
|
<li><b>merge</b>: merge two or more development histories together.</li>
|
|
|
|
<li><b>pull</b>: fetch from and update your local directory with the repository.</li>
|
|
|
|
<li><b>push</b>: update the remote repository with your changes.</li>
|
2018-11-14 21:15:38 +00:00
|
|
|
</ul>
|