The result shows that the SQL table has been modified: To show this, a simple change on one object is made:Īnd the SQL script is saved in the local repository folder. When the branch is checked out, any change committed will not affect the master branch in any way. The output confirms that the current branch is the MyDatabase2.0 branch, from now on: To switch to another branch, in this case, the MyDatabase2.0 branch, the following command is used: This means that the MyDatabase branch is only created, but the master branch is still the current one (used for committing changes). To verify that the MyDatabase2.0 branch is created, run the following command, that should give a list of all local branches: To create a new branch, the following command is executed: This is the point where Git branching comes into play. Other than that, any bug found in the MyDatabase1.0 version after it is released, has to be fixed from within the MyDatabase1.0 code line, which is in this case a master branch. Initial database version is released to production as MyDatabase1.0.īy looking at the remote repository where changes have been pushed, the following result shows that all changes are in the master branch (mainline):įor the next database release, there are a plenty of new features that have to be developed. All changes made during the development are committed to a local mainline and pushed to a master branch on a remote repository, using the Git Bash client. To show to how to maintain database changes using multiple branches, let’s establish a use case and some basics.Ī database used in this case called MyDatabase is being scripted, and all scripts are saved in a local folder initialized as a Git repository. Remote branches are on the remote repository, available for the entire team or anyone else that has the access to the repository. At this point changes made in a separate branch can be merged (integrated into mainline).įor the purpose of this article, a new local branch will be used for the next version of a database ( MyDatabase2.0).Īs the name says, the local branches are available only on a local machine and visible to a local user only. Branching allows a developer to work in an isolation (using a separate branch), until changes are “good enough” to be used by the rest of the team. In other words, no matter if a developer is working on some new functionality (new feature or experimenting), or modifying the existing one (bug fixes), it is essential that the rest of the team is not affected with changes, unless they are good enough to be used. Any change made in such cases can broke a database if it is partially finished, and as such used by other developers. Some of the most common use cases are, when developing a new feature, fixing bugs from the previous release, or when experimenting with database changes. The reason for using branches is a need to work in an isolation. Later, when changes are verified and approved, branches can be merged, which means that changes from a newly created branch will be integrated into another branch, which is typically the main code base. Having the ability to work in specific micro-environments that do not affect the rest of the team is essential. Large projects often require involvement of many roles such as developers, build managers, QA engineers, etc. The idea of branching is to develop in parallel. Branches are also known as trees, streams or code lines. When changes are verified, they can later be merged in an organized wayīranching means to diverge from the main path of development and work in isolation, without affecting the larger code base or affecting other developers. Without having the isolation while developing, the team will lack the freedom to code, without having to worry about breaking the existing code base.īranching is a solution that allows developers to work with changes from the repository in isolation, without having to worry about affecting the main code base. For instance, when developing a new feature, it may require a lot of changes to be committed, before the feature, or even a functional part of the feature becomes useful, so the rest of the team can apply it on their local copies of a database. Because of all of this, it is essential that any changes that have to be committed, but not immediately, are segregated to an isolated environment, that does not affect the rest of the team or the main code. In case of database development, in the same way as for the application development, there are always tasks such as developing a new feature, fixing bugs from the current release, experimenting with code in order to improve performance, usability in any way and so on.
0 Comments
Leave a Reply. |