Askgit: a git query tool based on SQL

Git provides powerful functions, which can have a panoramic view of the warehouse information and history. However, the use of GIT command is relatively cumbersome, and many times it needs to use other shell tools to form a stack to complete information query together, which is a difficult task for those who are not very familiar with shell command line. So what is the simple way to complete this task? < / P > < p > compared with many IT partners, they may be more familiar with SQL language, a general and convenient database query and operation language. This article introduces askgit, an open source tool for executing SQL queries in Git repository. The GIT repository on the disk is temporarily queried through the public interface to replace various cumbersome git command lines. The < / P > < p > command will download the software package, related class libraries, and compile all the contents into executable files. If you cannot determine where it is installed, check that gopath is set correctly, and then it ends with $gopath / bin. < / P > < p > this paper takes askgit’s GitHub warehouse as an example, and first clone a source code. Note that for some larger git warehouses, askgit operation is relatively slow, which may be a problem found at present. < / P > < p > the basic unit of Git is commit, which represents the change history of warehouse files. Through the information of commit, we can trace and reference the historical information of each file. < / P > < p > first of all, the earliest time for us to submit information to the warehouse. For most warehouses, the dates will be similar, using author_ When the code is written. For some historical projects, they may issue patches through e-mail or through committer_ When is the time when the code was added. < / P > < p > shows that the askgit warehouse was first submitted by Patrick devivo on July 3, 2020, and the project is actually a very new one. < / P > < p > it can be seen that the main developers of the project are Patrick devivo and vialenon, both submitted by them. < / P > < p > you can use the SQLite date function to view the activity of a project over time. As you can see, there are many activities at the beginning, and the activities gradually decrease. The < / P > < p > project is only two months old. It was submitted 71 times last month, adding 4584 lines of code and deleting 1315 lines of code. Only once this month, 254 codes were added and 136 codes were deleted. < / P > < p > if target_ Type is null, which means that it is a lightweight tag and is not submitted to be associated with it. In most cases, people submit, and because the submission has a date, it’s easier to associate. < / P > < p > you can ask all of the above questions based on the timestamp of the created tag. This will enable us to understand the progress of the project during this period. Let’s create a simple CSV file to make it easier to ask these questions. < / P > < p > askgit has a file table that shows the repository state at the time of a specific commit, so it is not very useful for actually tracking changes that occur during or between commits. It is best to use git diff tree and git log to find relevant information. < / P > < p > we can use… To specify the scope of submission, so let’s take a look at which files have changed to v1.7.0 between v1.5.0 and v1.7.0. < / P > < p > it’s useful to see when files were added. Similarly, askgit is very slow to use at this time. It is better to use git log much faster. < / P > < p > in this example, the specific file CMD is displayed/ root.go History. Some format options will be passed through — reverse to format and parse git log < / P > < p > in this paper, we introduce a new git tool askgit, which is developed by golang. Through parsing git object database, SQL query interface is implemented to query git related information. This tool provides a convenient method for people who are familiar with SQL and require git project analysis. However, compared with git native command, the tool used in large projects is obviously slow and has poor performance, so it needs to further improve the performance. Counterpoint announced top 5 best selling models: domestic iPhone 11 tops the list