Installation and Use
1. Download msysgit
Http://code.google.com/p/msysgit/
2. Download tortoisegit Client installation
Http://code.google.com/p/tortoisegit/
Set the GIT installation path:
Reprinted git instructions:
What is git?
Git defines on Wikipedia: it is a free, distributed version control tool, or a tool that emphasizes high speed.Source codeManagement tools. Git was initially developed by Linus Torvalds for Linux kernel management. Each git working directory is completely independent.CodeDatabase, with complete history and version tracking capabilities, independent of the network and central server.
The emergence of git has reduced the pressure on many developers and open-source projects to manage branch code. Due to its good control of branches, developers are encouraged to contribute to projects they are interested in. In fact, many open-source projects, including Linux kernel, Samba, x.org server, and Ruby on Rails, have transitioned to using git as their own version control tools. For developers who like to write code, there are two major advantages: We can submit our own code and view the code version anywhere (on the subway station at work; we can open many branches to practice our ideas, and the overhead of merging these branches is almost negligible.
Git usually has two methods for initialization:
git clone: this is a simple initialization method. When you have a remote git version library, you only need to clone it locally, for example, 'git clone git: // The github.com/someone/some_project.git some_project command is to clone 'git: // the local library to the local some_project directory.
git init and git remote: This method is a little more complex, when you create a local working directory, you can enter this directory and use the 'git init 'command for initialization. After git, it will control the version of the files in this directory, at this time, if you need to put it on the remote server, you can create a directory on the remote server and record the accessible URL, now you can use the 'git remote add' command to add a remote server, such as 'git remote add origin git: // github.com/someone/another_project.git'will Add the urladdress to 'git: // origin alias.
now we have a local and remote version library. Let's try using the basic git command:
git pull: update the code from other version libraries (either remote or local) to the local machine. For example: 'git pull origin master' is to update the code of the source database version to the master node of the local master node. This function is similar to the svn update
git Add: is to add the current changes or new files to the GIT index. Adding the changes to the GIT index indicates that the files are recorded in the version history. This is also a step to be executed before submission, for example, 'git add APP/model/user. RB will add APP/model/user. RB file to git index
git RM: delete the file from the current workspace and the index, such as 'git rm app/model/user. RB '
git commit: submits changes to the current workspace, similar to the svn commit command, such as 'git commit-M "story #3, add user model "', -m must be used to enter a piece of commit information during submission.
git push: update the code of local commit to the remote version library, for example, 'git push origin' will update the local code to a remote version library named orgin
git log: View historical logs
git revert: to restore a version modification, you must provide a specific git version number, for example, 'git revert bbaf6fb5060b4875b18ff9ff637ce118256d6f20 ', git versions are generated with a hash value
the above commands are almost all public in each version control tool. Next, let's try some unique git commands:
git branch: adds, deletes, and queries branches. For example, 'git branch new_branch' creates a new branch named new_branch from the current working version, 'git branch-D new_branch' will force the branch called new_branch to be deleted, and 'git branch' will list all local branches.
git checkout: git checkout has two functions, one is to switch between different branchs. For example, 'git checkout new_branch' switches to the new_branch branch. The other function is to restore the code, for example, 'git checkout APP/model/user. RB, the user. the RB file is updated from the previous submitted version. All unsubmitted content will be rolled back.