In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you what to do about git conflicts. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Prepare a new feature1 branch and continue our new branch development:
$git checkout-b feature1Switched to a new branch 'feature1'
Modify the last line of readme.txt to:
Creating a new branch is quick AND simple.
Submit on the feature1 branch:
$git add readme.txt $git commit-m "AND simple" [feature1 75a857c] AND simple 1 file changed, 1 insertion (+), 1 deletion (-)
Switch to the master branch:
$git checkout masterSwitched to branch 'master'Your branch is ahead of' origin/master' by 1 commit.
Git also automatically prompts us that the current master branch is 1 commit ahead of the remote master branch.
On the master branch, change the last line of the readme.txt file to:
Creating a new branch is quick & simple.
Submit:
$git add readme.txt $git commit-m "& simple" [master 400b400] & simple 1 file changed, 1 insertion (+), 1 deletion (-)
Now, the master branch and the feature1 branch each have new commits, which looks like this:
In this case, Git cannot perform a "quick merge" and can only try to merge their respective changes, but such a merge may be conflicting, so let's try it:
$git merge feature1Auto-merging readme.txtCONFLICT (content): Merge conflict in readme.txtAutomatic merge failed; fix conflicts and then commit the result.
There was a conflict! Git tells us that there is a conflict in the readme.txt file and that the conflict must be resolved manually before submitting. Git status can also tell us about conflicting files:
$git status# On branch master# Your branch is ahead of 'origin/master' by 2 commits.## Unmerged paths:# (use "git add/rm..." As appropriate to mark resolution) # # both modified: readme.txt#no changes added to commit (use "git add" and/or "git commit-a")
We can look directly at the contents of readme.txt:
Git is a distributed version control system.Git is free software distributed under the GPL.Git has a mutable index called stage.Git tracks changes of files. > feature1
Git marks the contents of different branches. We modify the following and save them:
Creating a new branch is quick and simple.
Resubmit:
$git add readme.txt $git commit-m "conflict fixed" [master 59bc1cb] conflict fixed
Now the master branch and the feature1 branch are as shown in the following figure:
You can also see the merging of branches with git log with parameters:
$git log-graph-pretty=oneline-abbrev-commit* 59bc1cb conflict fixed |\ | * 75a857c AND simple* | 400b400 & simple | / * fec145a branch test...
Finally, delete the feature1 branch:
$git branch-d feature1Deleted branch feature1 (was 75a857c).
The work is done.
Thank you for reading! This is the end of the article on "what to do with git conflicts". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.