In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to solve the conflict of Git merger". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Merging is not just a simple operation of adding and removing files. Git also merges changes.
$git branch* master$ cat runoob.php
First, we create a branch called change_site, switch over, and change the runoob.php content to:
< ?phpecho 'runoob';?>Create a change_site branch:
$git checkout-b change_siteSwitched to a new branch 'change_site'$ vim runoob.php$ head-3 runoob.php
< ?phpecho 'runoob';?>$git commit-am 'changed the runoob.php' [change_site 7774248] changed the runoob.php 1 file changed, 3 insertions (+)
Submit the changes to the change_site branch. Now, if we switch back to the master branch, we can see that the content is restored to what we modified (empty file, no code), and we modify the runoob.php file again.
$git checkout masterSwitched to branch 'master'$ cat runoob.php$ vim runoob.php # modified as follows: $cat runoob.php
< ?phpecho 1;?>$git diffdiff-- git a/runoob.php b/runoob.phpindex e69de29..ac60739 100644 Mustang-a max runoob.phphands @-0meme0 + 1mem3 @ +
< ?php+echo 1;+?>$git commit-am 'modify Code' [master c68142b] modify Code 1 file changed, 3 insertions (+)
Now these changes have been recorded in my "master" branch. Next, let's merge the "change_site" branch.
$git merge change_siteAuto-merging runoob.phpCONFLICT (content): Merge conflict in runoob.phpAutomatic merge failed; fix conflicts and then commit the result.$ cat runoob.php # opens the file and sees the conflicting content
< ?php>Change_site? >
We merge the previous branch into the master branch, and a merge conflict occurs, and then we need to manually modify it.
$vim runoob.php $cat runoob.php
< ?phpecho 1;echo 'runoob';?>$git diffdiff-- cc runoob.phpindex ac60739,b63d7d7..0000000--- a _ Runoob.php _ circle @-1 _
< ?php +echo 1;+ echo 'runoob'; ?>In Git, we can use git add to tell Git that the file conflict has been resolved
$git status-sUU runoob.php$ git add runoob.php$ git status-sM runoob.php$ git commit [master 88afe0e] Merge branch 'change_site'
Now we have successfully resolved the conflict in the merger and submitted the results.
This is the end of the content of "how to solve the conflict of Git merger". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.