Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the merge branch in Git?

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you what is the merged branch of Git, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.

The premise of this paper: there are three branches of master, test and dev locally and remotely, and they correspond to each other one by one. After the local dev development is completed, it should be merged into test,test and merged into master after testing.

1. When merging from dev to test, the two branches of master and test prohibit ordinary developers from directly push. Now we are talking about the operations of people with permissions. In the course of development, no matter whether you want to merge branches or not, no matter in which branch, note that the local branch should be push to remote after commit, and the consistency of the same branch should be maintained first. 1 first switch to the dev branch, execute commit and push2 authorized personnel after pulling all the code in each branch git pull, then transfer from dev to testgit checkout test3 and then merge from dev to testgit merge dev Note: this kind of merge generally uses fast forward mode (Fast-forward), that is, directly pointing test to the current submission of dev, so the merge speed is very fast. However, in this mode, when the dev branch is deleted, the branch information is lost. If the Fast forward mode is to be forcibly disabled, Git generates a new commit when merge, so that the branch information can be seen from the branch history. The command is as follows: git merge-- no-ff-m "merge dev to test with no-ff" dev because this merge will create a new commit, so add the-m parameter to write the commit description in. It is recommended to use this no-ff mode in development. Now that the local dev has been merged into the test, let's submit the changes of the local test to the remote (currently in the test branch): git push Let's take a look at the network diagram of the test branch on the remote server:

2. The operation flow of merging from test to master is similar to the previous one: 1 git checkout master2 git merge-- no-ff-m "merge test to master with no-ff" test3 git push Let's take a look at the network diagram of the master branch on the remote server:

3. In other cases, the push operation of everyone is sometimes prohibited in the remote warehouse private server, so the merge branch can only be carried out on the private server page. This operation is generally carried out by people with high permissions, but many old versions of gitlab have problems in this respect, and there will be error pages. You can try it several times.

The above is the merger branch of Git. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report