246 lines
7.5 KiB
Plaintext
246 lines
7.5 KiB
Plaintext
|
<!-- 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> </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 config --global user.name “your_name” </span></p>
|
|||
|
<p></p>
|
|||
|
<p ><span>$git config --global user.email “your_email”</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> </td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td><p >Tips: </p></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td><p >You can read the user manual by enter " <span>git 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 help <command></span> </p></td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
<table width="898" border="0">
|
|||
|
<tr>
|
|||
|
<td> </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) 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 clone 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> </td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td><p >(2) Initialize a repository on the local, we named repository as “DEMO” 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 the directory, execute the "<span>git init</span>" command to create the repository.</p></td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
<table width="327" border="0" align="left">
|
|||
|
<tr>
|
|||
|
<td width="321"><p ><span> $cd /path/to/my/workspace </span></p></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td><p ><span> $mkdir demo</span> </p></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td><p ><span> $cd demo </span></p></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td><p ><span> $git init </span></p></td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
<p> </p>
|
|||
|
<p> </p>
|
|||
|
<table width="898" border="0">
|
|||
|
<tr>
|
|||
|
<td><p >After completed these operation, you can see "<span>git init</span> " command creates a hidden directory in the workspace and this hidden directory is the git repository. </p></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td> </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 add file1 file2 </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 commit –m "commit message" </span></p></td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
<table width="898" border="0">
|
|||
|
<tr>
|
|||
|
<td width="891"><p >“<span>commit message</span>”is a submission instructions which is a mandatory requirement in the Git, you can use "<span>git log</span>" to list the commit log. </p></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td> </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 remote add origin http://user_name@domain/repo_path.git </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 push origin master </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"> </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 pull</span> " (or "<span>git 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 pull origin 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"> </td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td align="right">--By Trustie Team</td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
<p> </p>
|
|||
|
<p> </p>
|
|||
|
<p> </p>
|
|||
|
<p> </p>
|
|||
|
<p> </p>
|
|||
|
</body>
|
|||
|
</html>
|
|||
|
|
|||
|
<!-- end -->
|