The previous companies are using SVN, long time to feel very handy. Now the company uses GIT to manage the code, so learn the basic use of **git. First, we introduce a simple comparison of SVN and git:
1,SVN is the most used version control management tool.
is a centralized version-management tool. All files are centralized on a single server, the user is updated through this server, and once the server fails, it will not work together.
SVN is stored by file. All resource control systems hide the meta-information of files in a folder similar to. Svn,.cvs.
The advantage of 2,git is that it is easy to add branch and distributed features locally, which can be submitted offline, which solves the problem that SVN can't solve by the team co-development in different places.
Distributed version management attacks. The user has a cloned repository.
Git is stored on a meta-data basis. If you compare the size of the. git directory with the. SVN, you will find that they are very different. Because the. Git directory is a cloned version of the repository on your machine that has everything on the central repository, such as tags, branches, release notes, and so on.
Can be easily understood as SVN save the public modified file records only one copy, stored on the server, when many people use accidentally, it may overwrite others ' code, causing damage to the project.
The changes that Git saves are local and server records, and all code that needs to be committed must be submitted locally, with the cloned repository locally. two. Git uses
The Git plugin is installed by default, the secret key is configured, and so on.
1.git Create a new project.
Log on to the GIT server and create a new project:
$ ssh g*** @gitthub. com
$ cd de
$ mkdir Hello.git
$ git init
This part of the code is mainly to create a new project on the server, and then go to the local clone ". Git" information, and add the project files to the project
2.git Clone New Project
$ CD D:
$ git clone g*** @github. Com:de/hello
$ cd Hello
This part of the main is to copy the Hello project in the local D-Disk Hello directory, the next need to put the project's files in this directory, and then add the file to the file record
3.git adding new files and folders
$ git Add.
$ git commit-m "init project"
Git add is a bit behind, indicating that all the files and folders in the current directory are added to the index and then submitted locally.
At this point we can view the status of the current project by following this command:
$ git status
There will be red text to prompt you, new additions to those files.
4.git Project Association
If it's a new project, remember to use the following command to associate a local project with a remote project,
$ git Remote add Origin g*** @github. com:de/hello.git
And then through
$ git remote-v
See if the association was successful.
5. Project Submission Server
At this point we can commit the local project, using the following command:
$ Git push-u Origin Master
6. Project Consolidation
If you want to use the merge command after the project has changed, submit
$ Git Merge Origin Master