2016/01/13 Start learning git: Branch management: Resolving conflicts

Source: Internet
Author: User
Tags version control system

After you create a new branch, commit, or switch back to the master branch again Commit;git cannot be quickly merged at this time.

Can git status find conflicting files Readme.txt, view and modify, and then submit again

1. Create new branch Feature1, add Readme.txt content, then add and commit

Git checkout-b feature1
Modify the last line of Readme.txt to read:
Creating a new branch is quick and simple.
git add readme.txt
Git commit-m "and simple"

2. Switch back to the Master branch, add the Readme.txt content, then add and commit

git checkout Master
Modify the last line of Readme.txt to read:
Creating a new branch is quick & simple.
git add readme.txt
Git commit-m "& Simple"

3. Merge Error

git merge Feature1
Conflict
git status can also tell us about conflicting files

4. Modifications

View 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.
<<<<<<< HEAD
Creating a new branch is quick & simple.
=======
Creating a new branch is quick and simple.
>>>>>>> Feature1

git uses <<<<<<<,=======,>>>>>>> to mark different branches of content ,
We modify the following after saving:
Creating a new branch is quick and simple.

5. Submit

git add readme.txt
Git commit-m "Conflict fixed"

6. Use the git log--graph command to see the branch merge diagram

You can also see the merging of branches with the git log with parameters:
git log--graph--pretty=oneline--abbrev-commit

7. Delete Feature1 Branch

To delete a feature1 branch:
Git branch-d feature1

2016/01/13 Start learning git: Branch management: Resolving conflicts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.