Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 712481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:51:11+00:00 2026-05-14T04:51:11+00:00

I have a file with one line in it. I create a branch and

  • 0

I have a file with one line in it.
I create a branch and add a second line to the same file. Save and commit to the branch.
I switch back to the master. And add a different, second line to the file. Save and commit to the master.
So there’s now 3 unique lines in total.

If I now try and merge the branch back to the master, it suffers a merge conflict.

Why cant Git simple merge each line, one after the other?

My attempt at merge behaves something like this:

PS D:\dev\testing\test1> git merge newbranch
Auto-merging hello.txt
CONFLICT (content): Merge conflict in hello.txt
Automatic merge failed; fix conflicts and then commit the result.
PS D:\dev\testing\test1> git diff
diff --cc hello.txt
index 726eeaf,e48d31a..0000000
--- a/hello.txt
+++ b/hello.txt
@@@ -1,2 -1,2 +1,6 @@@
  This is the first line.
- New line added by master.
 -Added a line in newbranch.
++<<<<<<< HEAD
++New line added by master.
++=======
++Added a line in newbranch.
++>>>>>>> newbranch

Is there a way to make it slot lines in automatically, one after the other?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:51:11+00:00Added an answer on May 14, 2026 at 4:51 am

    Let’s say the file branch A looks like:

    First line
    Branch A's second line
    

    And branch B looks like:

    First line
    Branch B's second line
    

    When you merge, there are two different ways to resolve it. Here’s one way:

    First line
    Branch A's second line
    Branch B's second line
    

    Here’s another way:

    First line
    Branch B's second line
    Branch A's second line
    

    Git has no idea which one of those two options you prefer, or if either are even acceptable merges.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have a text file (one word per line) and I want to
I have a file named file with three lines: line one line two line
if I have a text file like this : this is line one This
I have a text file that has item numbers in it (one per line).
Say I have two files where there is one number per line File 1
I have a *.txt files having integers, one on each line. So the file
In bash I have a file called temporary.txt that contains one line of text.
I have a file that has one entry per line. Each line has the
I have one file in my project, (the readme file,) which I would like
I have one file (for example: test.txt), this file contains some lines and for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.