git merge auto resolving instead of showing merge conflict

42 Views Asked by At

I've two branches feature and development and for the sake of simplicity, assuming that both the branches have only one file, say test.py

In feature branch,test.py is as follows

--few lines ---
renewal_id = models.IntegerField(null = True)
renewal_counter = models.IntegerField(null = True)

In development branch,test.py is as follows

--few lines ---
renewal_id = models.IntegerField(null = True)
cancelled_amount = models.IntegerField(null = True)
cancelled_amount_tax = models.IntegerField(null = True)
cancelled_by = models.CharField(null = True)

For merging, I'm creating a new branch called temporary_branch_for_merging from feature and merging the development into the new branch but it auto resolves instead of showing merge conflict

git checkout feature
git branch -b temporary_branch_for_merging
git merge development

I'm expecting it to show my a conflict as but the file gets auto-merged and the final result looks like this:

--few lines ---
renewal_id = models.IntegerField(null = True)
cancelled_amount = models.IntegerField(null = True)
cancelled_amount_tax = models.IntegerField(null = True)
cancelled_by = models.CharField(null = True)
 

what I want the final output to be like :

--few lines ---
renewal_id = models.IntegerField(null = True)
renewal_counter = models.IntegerField(null = True) <<< this line to get added after the merge
cancelled_amount = models.IntegerField(null = True)
cancelled_amount_tax = models.IntegerField(null = True)
cancelled_by = models.CharField(null = True)

on doing git diff my_hash:test.py HEAD:test.py in temporary_branch_for_merging i get something like :

  --few lines ---
  renewal_id = models.IntegerField(null = True)
- renewal_counter = models.IntegerField(null = True)
+ cancelled_amount = models.IntegerField(null = True)
+ cancelled_amount_tax = models.IntegerField(null = True)
+ cancelled_by = models.CharField(null = True)
0

There are 0 best solutions below