git create new project, download project, merge and update project simple application record

It used to be easy to use SVN, but now the company uses git to manage code, so learn the basic use of git.

one. First, let's introduce a simple comparison between SVN and git:

SVN is the most used version control management tool.

  1. It is a centralized version management tool. All files are centralized on a server, and users are updated through this server. Once the server fails, it cannot work together.

  2. SVN is stored by file.

    All resource control systems hide the file's meta information in a folder like .svn, .cvs, etc.

The advantage of Git is that it is easy to add branches and distributed locally, and it can be submitted offline, which solves the problems that svn cannot solve such as collaborative development of remote teams.

  1. Distributed version management attacks. The user owns the cloned repository.

  2. GIT is stored by metadata.

  If you compare the size of the .git directory with that of .svn, you will find that
  they are quite different. Because, the .git directory is a cloned version of the repository on your machine, and it has everything on the central repository, such as tags, branches, version records, etc.

  

  It can be simply understood that there is only one public modification file record saved by SVN, which is stored on the server. When multiple people use it accidentally, it may overwrite other people's code and cause project damage.

      The modification records saved by SVN include local records and server records. All the code that needs to be submitted must be submitted locally, and the cloned version library can be owned locally.

two. GIT use

  By default, the git plugin has been installed, and the secret key has been configured.

    1.git create a new project.

    Log in to the git server and create a new project:

  

?
1
2
3
4
$ cd de
$ mkdir hello.git
$ git init

  The above part of the code is mainly to create a new project on the server, then enter the local clone ".git" information, and add the project file to the project at the same time,

  2. git clone new project

?
1
2
3
$ cd d:
$ git clone [email protected]:de/hello
$ cd hello

   This part is mainly to copy the hello project to the hello directory of the local d disk. Next, you need to put the project files in this directory, and then add the files to the file record.

    3.git add new files and folders

?
1
2
$ git add .
$ git commit -m "init project"

 There is a dot after git add, which means that all files and folders in the current directory are added to the index, and then submitted to the local.

 At this time, we can view the status of the current project with the following command:

?
1
$ git status

  There will be red text prompting you that those files have been newly added.

  4. git project association

If it is a new project, you must remember to use the following command to associate the local project with the remote project,

?
1
$ git remote add origin [email protected]:de/hello.git

  then pass

?
1
$ git remote -v

  Check if the association is successful.

  5. Project submission server

At this point, we can submit the local project, using the following command:

?
1
$ git push -u origin master

  6. Project Consolidation

  If the project changes, use the merge command, and then submit

?
1
$ git merge origin master

  

three. Use caution

  For the android project, we don't need the gen and bin directories, so don't copy these two directories when you submit the file for the first time,

   At the same time a file ".gitignore" can be used - the content inside is:

                    /gen
                    /bin

   Indicates that the contents of these two folders are ignored.

 

 

 

Four. Use gitolit-admin to create a new repository

      

 

 



 

 <! - StartFragment ->

 

      

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326222539&siteId=291194637