When two developers create two separate branches from the same repo and while development they edit the same line and one developer merges it back before another. First, we will understand this with a below example. Merge conflicts are one of the tedious tasks we get to resolve while merging our branch to stage or master. Now we only need to push this branch to GitLab and raise an MR regarding only our changes and then we will see that now there are only our commits in the raised MR. These three steps will automatically add our commits to the newly created branch from stage. Just keep in mind that all the commits between these two are required changes. But here is one command using which we can cherry- pick all the commits at one. Suppose we have made more than one commits our previous branch, then it may take a lot of time in cherry-picking all the commits one by one. Return to VS code and type the following command.Create a local branch from stage-release.We can simply do it using the following steps. The best way to rebase our code with stage-release is cherry-picking our commits to a new branch. How to rebase the code with stage-release To resolve this problem we need to rebase our feature branch with the branch where we are going to merge it.Īt Halodoc we follow this git branching strategy:Īs shown above, for stage environment we use stage-release branch and after getting the sign-off from tester the respective feature branch is merged to master branch to add the feature in our production website. So the commits which may be present in master may not be present in stage-release or vice-versa. In any organisation, there are a lot of developers working on the same repo for different changes. There are many complexities we may have to handle while merging our code to it's origin branch. This is a basic diagram to show the flow of code while working on any front-end project. We will understand it better with the help of the following illustration. We also have a staged website which is a reduced version of our main website, and it is run by code from the stage-release branch, so initially, every developer has to merge into it, then it gets tested, and if there are any bugs, tickets are issued to developers, and after resolving all the bugs the new branch is approved to merge with master. Here comes the use of the second branch i.e. If we merge it directly to master then the wrong code can create too many bugs in our production website and then it will generate frustration among our users. We need to test the changes made by a developer. Then we make the necessary changes and merge it back, simple. If there is any feature change or any bug fix is scheduled, then we need to always create our local branch from master. Master is the main branch whose code is running live in production. Each repository has two important branches. Here at Halodoc we use Gitlab to maintain the codebase on the cloud. Our changes can be stored in the cloud and can also be fetched locally, where we can do development.This allows it to employ all the changes with minimal data. During merging, the merge tool only adds the changes to the origin branch and does not create a new branch.In development, it is termed the master branch. We can simply merge our branch with the added changes into the main or production branch.In the form of commits, Git contains all the documentation regarding the changes and the developer who made them.We can make our changes in local and deploy them for testing in another branch meant for it.A clone of our production website can be easily created, which is known as branching.Git is a software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. GIT provides a great documentation and storage space for our codebase, but we need to use this space efficiently without creating a mess with our branches and commits.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |