socialforge/app/views/git_usage/en_usage.html.erb

246 lines
7.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- added by baiyu -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
body table tr th {
font-size: 24px;
color: #666;
font-family: "Comic Sans MS", cursive;
}
body table tr td {
color: #333;
}
body table tr td {
color: #333;
font-size: 18px;
font-family: "Comic Sans MS", cursive;
}
body table tr td span {
color: #039;
}
body p {
font-size: 18px;
color: #009;
}
body table tr td p {
color: #333;
font-family: "Comic Sans MS", cursive;
}
</style>
</head>
<body><table width="898" border="0">
<tr>
<th width="890" align="center" valign="middle"> Git User Guide</th>
</tr>
</table>
<table width="892" border="0">
<tr>
<td width="886">We will use <span>git</span> which is a distributed version control and source code management system to submit our code, here is the submission method.</td>
</tr>
</table>
<table width="456" border="0">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td width="450"><p ><span>Step1</span> </p></td>
</tr>
<tr>
<td><p >Enter the following command in the terminal</p></td>
</tr>
<tr>
<td align="center"><p ><span>$git&nbsp;config&nbsp;--global&nbsp;user.name&nbsp;&#8220;your_name&#8221; </span></p>
<p></p>
<p ><span>$git&nbsp;config&nbsp;--global&nbsp;user.email&nbsp;&#8220;your_email&#8221;</span></p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td><p >User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository). </p></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><p >Tips </p></td>
</tr>
<tr>
<td><p >You can read the user manual by enter "&nbsp;<span>git&nbsp;help</span> " command when you are confused, command as follows: </p></td>
</tr>
</table>
<table width="297" border="0">
<tr>
<td width="291" align="center"><p ><span>$git&nbsp;help&nbsp;&lt;command&gt;</span> </p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><p ><span>Step2:</span> </p></td>
</tr>
<tr>
<td><p >Create a new repository by two ways, here we go </p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td><p >(1)&nbsp;The first way is clone a repository which is already exists from remote Server to local: </p></td>
</tr>
</table>
<table width="522" border="0">
<tr>
<td width="516" align="center"><p ><span>$git&nbsp;clone&nbsp;http://user_name@domain/repo_path.git</span> </p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td width="892"><p > The "domain" in the command means the server's domain name(the domain name in Trustie system is 222.247.54.100), "repo_path.git" is the relative path(this address will be given in Trustie) </p></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><p >(2)&nbsp;Initialize a repository on the local, we named repository as &#8220;DEMO&#8221; for example, use the directory "/path/to/my/workspace" as a root of personal workspace. </p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td><p >Enter&nbsp;the&nbsp;directory,&nbsp;execute&nbsp;the&nbsp;&quot;<span>git&nbsp;init</span>&quot;&nbsp;command&nbsp;to&nbsp;create&nbsp;the&nbsp;repository.</p></td>
</tr>
</table>
<table width="327" border="0" align="left">
<tr>
<td width="321"><p ><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cd&nbsp;/path/to/my/workspace </span></p></td>
</tr>
<tr>
<td><p ><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$mkdir&nbsp;demo</span> </p></td>
</tr>
<tr>
<td><p ><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cd&nbsp;demo </span></p></td>
</tr>
<tr>
<td><p ><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$git&nbsp;init&nbsp; </span></p></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="898" border="0">
<tr>
<td><p >After completed these operation, you can see "<span>git&nbsp;init</span> " command creates a hidden directory in the workspace and this hidden directory is the git repository. </p></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><p ><span>Step3</span> </p></td>
</tr>
<tr>
<td><p >Submit the file to the local repository: </p></td>
</tr>
</table>
<table width="258" border="0">
<tr>
<td width="252" align="center"><p ><span>$git&nbsp;add&nbsp;file1&nbsp;file2&nbsp; </span></p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td><p >"file1" is the file which is already modified, multiple files separated by spaces. </p></td>
</tr>
</table>
<table width="388" border="0">
<tr>
<td width="380" align="center"><p ><span>$git&nbsp;commit&nbsp;&#8211;m&nbsp;&quot;commit&nbsp;message&quot;&nbsp; </span></p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td width="891"><p >&#8220;<span>commit&nbsp;message</span>&#8221;is a submission instructions which is a mandatory requirement in the Git, you can use "<span>git&nbsp;log</span>" to list the commit log. </p></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><p ><span>Step4</span> </p></td>
</tr>
<tr>
<td><p >Push the local branches to the remote repository: </p></td>
</tr>
<tr>
<td><p >The operation we mentioned above is only to establish a local git repository, we can push it to the remote server in order to work together in the future. </p></td>
</tr>
</table>
<table width="610" border="0">
<tr>
<td width="604" align="center"><p ><span>$git&nbsp;remote&nbsp;add&nbsp;origin&nbsp;http://user_name@domain/repo_path.git&nbsp;</span> </p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td><p >In Git, we call remote repository as <span>origin</span> </p></td>
</tr>
</table>
<table width="292" border="0">
<tr>
<td width="328" align="center"><p ><span>$git&nbsp;push&nbsp;origin&nbsp;master&nbsp; </span></p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td width="485"><p >Push the local master branch to the origin master branch . </p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td width="898">&nbsp;</td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td><p ><span>Step5</span> </p></td>
</tr>
<tr>
<td><p >Get the latest branch from the remote repository: </p></td>
</tr>
<tr>
<td><p >When your team members push the code to the server, we can use "<span>git&nbsp;pull</span>&nbsp;" (or "<span>git&nbsp;fetch</span>") to obtain the modified code.。</p></td>
</tr>
</table>
<table width="279" border="0">
<tr>
<td width="273" align="center"><p ><span>$git&nbsp;pull&nbsp;origin&nbsp;master </span></p></td>
</tr>
</table>
<table width="898" border="0">
<tr>
<td><p >Pull the remote master branch to the local master branch.</p></td>
</tr>
</table>
<table width="894" border="0">
<tr>
<td width="888">&nbsp;</td>
</tr>
<tr>
<td align="right">--By Trustie Team</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
<!-- end -->