How to record release history for a web project in Git?

I am working on a web project with frequent mergers and releases into production. I would like the repository to contain a complete record of everything that has ever been clicked on to the production server, mainly so that I can analyze the error log record from three weeks ago, knowing exactly what code was in production at that time.

I cannot use the release branch for this because in Git there is no concept of the history of commits made on a particular branch. We are currently using the release branch, but it does not allow me to answer the question "what code was in production three weeks ago."

So how do I do this in Git?

+4
source share
3 answers

Tags are intended for such use on git. You can read about the tags here .

According to your question, you can have a list of all tags, therefore, knowing what was released. An example of this in a gm scm book:

 $ git tag -l 'v1.4.2.*' v1.4.2.1 v1.4.2.2 v1.4.2.3 v1.4.2.4 

Checking a specific tag will put you in the same state as when you released the code.

You can even GPG sign tags that can be useful in a common repository if you are worried that someone is mixing things up (either by design or by accident).

Note:

By default, the git push command does not pass tags to the remote server. You will have to explicitly click tags on the shared server after you create them. This process is similar to exchanging a remote branch - you can run git push origin [tagname].

as this can lead to a terrible headache if you suspect that this has happened.

As always in git, all you really need is a sha commit, so writing this file may be sufficient, depending on your needs.

+2
source

If each code clicks on production, it is a merge into release branches, you will have commits called Merge branch 'master' into release , with a timestamp at the time of the merge. In the default git log, you only see what the current branch commits, so you can see what was in production using the merge timestamps to determine what is the last commit in the release branch that was pressed at that time.

+1
source

When you create a production release, you can either create a tag that represents this particular assembly, or simply save the current SHA1 hash of that particular commit.

With some additional build logic, you can mark your release with this hash number that uniquely identifies your version. Some examples of how to do this in ANT-Builds can be found here .

+1
source

Source: https://habr.com/ru/post/1491416/


All Articles