Git User Guide
We will use git which is a distributed version control and source code management system to submit our code, here is the submission method.
 
Windows
1. Installation

Step1:

Download msysgit from http://code.google.com/p/msysgit, the version we have used is

Git-1.7.4-preview20110204.exe.

Please tick "Checkout as-is" and "commit as-is" options during installation so git does not modify the line feed style. Other options you can use the default settings.

 

Step2:

Download TortoiseGit from http://code.google.com/p/tortoisegit/, the version we have used is

Tortoisegit-1.6.5.0-32bit.msi.

Please tick "TortoisePLink" option during installation.

You can start using Git when you complete the installation.

 

Step3:

You can create a branch with method that right-click the "TortoiseGit" in the directory and check the "Create Branch… " option.

 
2. Configuration

Right-click on the desktop and select the "Settings" in the "TortoiseGit"

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, the name and email must be the same with login name and email you registed in the forge.trustie.net ).

Then you can customize the "Context Menu":

Please check the "Clone","Sync" and "Commit" options in the "Context Menu",

check the "Import Svn Ignore", "Show Reflog", "Browse References", "Stash Apply" and "Submodule Sync" in the "Set Extend Menu Item".

 
3. Simple usage

Step1:

Create a new repository by two ways, here we go

(a) You can create a repository by right-click in the folder and select "Git Create repository here". Uncheck any options in the new window, instead of it please click "OK".

After completed these operation, you can see there is a hidden directory ( .git ) in the workspace and this hidden directory is the git repository.

(b) Clone a exist version from the remote server to local: right-click in the folder and select " Git Clone.." and fill in the URL where you had clone from.

 

Step2:

Add the new file and folder

Right-click in the folder and select Git Commit -> "master"… , then fill in the "Message" and check the " Whole Project " option so that the whole information of the project can commit.

For example:

Create a new file in the workspace named "file1.txt", commit it, and then creat a new folder in the workspace named "dir1", after that create a new file again, but this file is in the folder dir1, named "file2.txt". After that select "Git Commit", then file1 and dir1 can be joined together.

 

Step3:

Create a new Branch

You can create a new branch by right-click in the folder and select TortoiseGit -> " create Branch… ".

You will switch to the new branch when you check "Switch to new branch" option.

For example:

Create a new file in the workspace named "file3.txt", commit it. And you can switch to the "master" by select the "Switch/Checkout..." in the "TortoiseGit".

 

Step4:

View and modify the log

You can view the situation of the branch by right-click in the folder and select TortoiseGit -> " Show log". Even you can also modify the log in it. And you can view all the branch's situation by check the " All Branches " option.

In the "Message" colume, branch is green and the current branch is red .

 

Step5:

Compare the version

You can select two version in the same time by press "shift", and you can compare the different between two version by right-click the " Compare revisions ".

 

Step6:

Merge the branch

First, you should switch to the "master", then righr-click on it and select TortoiseGit -> "Merge" so that the branch can merge into the main version.

 

Step7:

Other operations

(a) Stash

Git provides a function named Stash to temporarily store the revised programs. When you revise some programs but still do not want to commit them, you can stash these revised programs and pop them if you need them then.

(b) Ignore Files

The editor will generate some .bak files after editing. If you do not want to add these .bak files to the repository you can select the ".bak" file and check the "*.bak" in the " Add to ignore list". Then the .bak files will not be commited.


 

Tips:

You can read the user manual by enter " git help " command when you are confused, command as follows:

$git help <command>
 
Linux
1.Installation

If you are useing Linux, you can install git through native package management system.

$ yum install git-core

if you are using redhat, you should type "yum".

$apt-get install git-core

if you are using debian or ubuntu, you should type "apt-get".

 
2. Configuration

$git config --global user.name “your_name”M

$git config --global user.email “your_email” 

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, the name and email must be the same with login name and email you registed in the forge.trustie.net ).

 
3. How to commit

cd file1

$ git add file1

$ git init

$ git commit -a

$ git remote add [name] [The URL which we give you in our website(with out http)]

$ git push [name] master

The last step is enter your password.

 

—— By Trustie Team