转载自:https://dev.mysql.com/doc/internals/en/getting-source-tree.html
This section describes how to obtain the MySQL source tree, which is currently available on GitHub.
MySQL officially joined GitHub in September, 2014. For more information about MySQL's move to GitHub, refer to the announcement on the MySQL Release Engineering blog: MySQL on GitHub
To obtain the MySQL source tree from GitHub, perform the following steps:
-
Clone the MySQL Git repository to your machine. The following command clones the MySQL Git repository to a directory named
mysql-server
. The download size is approximately 437 MB.me@mymachine:~$ git clone https://github.com/mysql/mysql-server.git Cloning into 'mysql-server'... remote: Counting objects: 1035465, done. remote: Total 1035465 (delta 0), reused 0 (delta 0) Receiving objects: 100% (1035465/1035465), 437.48 MiB | 5.10 MiB/s, done. Resolving deltas: 100% (855607/855607), done. Checking connectivity... done. Checking out files: 100% (21902/21902), done.
-
When the clone operation completes, the contents of your local MySQL Git repository appear as shown:
me@mymachine:~$ cd mysql-server me@mymachine:~/mysql-server$ ls BUILD COPYING libmysqld regex tests BUILD-CMAKE dbug libservices scripts unittest client Docs man sql VERSION cmake extra mysql-test sql-bench vio CMakeLists.txt include mysys sql-common win cmd-line-utils INSTALL-SOURCE packaging storage zlib config.h.cmake INSTALL-WIN-SOURCE plugin strings configure.cmake libmysql README support-files
-
Your MySQL Git repository contains MySQL 5.5, 5.6, and 5.7 branches. Run the git branch -r command to view the “remote-tracking”branches:
~/mysql-server$ git branch -r origin/5.5 origin/5.6 origin/5.7 origin/HEAD -> origin/5.7
-
Run the git branch command to view branches that are currently checked out locally. When you cloned the MySQL Git repository, the MySQL 5.7 branch was checked out automatically. The asterisk identifies the 5.7 branch as the active branch.
~/mysql-server$ git branch * 5.7
-
To check out the other MySQL branches, run the git checkout command, specifying the branch name:
~/mysql-server$ git checkout 5.6 Branch 5.6 set up to track remote branch 5.6 from origin. Switched to a new branch '5.6' me@mymachine:~/mysql-server$ git checkout 5.5 Branch 5.5 set up to track remote branch 5.5 from origin. Switched to a new branch '5.5'
-
Run
git branch
again to verify that all three branches are present. MySQL 5.5, which is the last branch you checked out, is marked by an asterisk indicating that it is the current branch.~/mysql-server$ git branch * 5.5 5.6 5.7
To switch branches, run git checkout again. For example, to make MySQL 5.6 the active branch, run git checkout 5.6.
For more information about working with and maintaining Git repositories, refer to GitHub Help.