title: Django duplicate migrations in apps
body: <p>Django keeps making duplicate migrations in for my application. I've ran <code>makemigrations</code> and <code>migrate</code> before I changed my model. After the changes I ran <code>makemigrations</code> again to make migrations for the updated model, I got the following error:</p>
  
  <pre><code>CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0001_initial, 0001_initial 3 in sessions; 0002_remove_content_type_name 3, 0002_remove_content_type_name, 0001_initial 3 in contenttypes; 0002_alter_permission_name_max_length 3, 0010_alter_group_name_max_length 3, 0007_alter_validators_add_error_messages 3, 0006_require_contenttypes_0002 3, 0005_alter_user_last_login_null 3, 0001_initial 3, 0008_alter_user_username_max_length 3, 0009_alter_user_last_name_max_length 3, 0011_update_proxy_permissions, 0011_update_proxy_permissions 3, 0004_alter_user_username_opts 3, 0003_alter_user_email_max_length 3 in auth; 0003_logentry_add_action_flag_choices 3, 0002_logentry_remove_auto_add 3, 0003_logentry_add_action_flag_choices, 0001_initial 3 in admin).
  </code></pre>
  
  <p>To fix them run 'python manage.py makemigrations --merge'</p>
  
  <p>Running <code>makemigrations --merge</code> doesn't work: <code>ValueError: Could not find common ancestor of {'0002_remove_content_type_name', '0002_remove_content_type_name 3', '0001_initial 3'}</code></p>
  
  <p>There are many duplicate migrations in apps that I haven't touched (auth, admin, etc.):</p>
  
  <pre><code>admin
   [ ] 0001_initial 3
   [X] 0001_initial
   [ ] 0002_logentry_remove_auto_add 3
   [X] 0002_logentry_remove_auto_add
   [X] 0003_logentry_add_action_flag_choices
   [ ] 0003_logentry_add_action_flag_choices 3
  auth
   [ ] 0001_initial 3
   [X] 0001_initial
   [ ] 0002_alter_permission_name_max_length 3
   [X] 0002_alter_permission_name_max_length
   [ ] 0003_alter_user_email_max_length 3
   [X] 0003_alter_user_email_max_length
   [ ] 0004_alter_user_username_opts 3
   [X] 0004_alter_user_username_opts
   [ ] 0005_alter_user_last_login_null 3
   [X] 0005_alter_user_last_login_null
   [ ] 0006_require_contenttypes_0002 3
   [X] 0006_require_contenttypes_0002
   [ ] 0007_alter_validators_add_error_messages 3
   [X] 0007_alter_validators_add_error_messages
   [ ] 0008_alter_user_username_max_length 3
   [X] 0008_alter_user_username_max_length
   [ ] 0009_alter_user_last_name_max_length 3
   [X] 0009_alter_user_last_name_max_length
   [ ] 0010_alter_group_name_max_length 3
   [X] 0010_alter_group_name_max_length
   [X] 0011_update_proxy_permissions
   [ ] 0011_update_proxy_permissions 3
  contenttypes
   [ ] 0001_initial 3
   [X] 0001_initial
   [X] 0002_remove_content_type_name
   [ ] 0002_remove_content_type_name 3
  database
   (no migrations)
  sessions
   [X] 0001_initial
   [ ] 0001_initial 3
  </code></pre>
  
  <p>The only app that, as far as I know, should've been affected is <code>database</code>. Why is Django making these duplicate migrations? Is there any way I can get rid of these? Or apply them so they are not blocking anymore? How I can make sure this doesn't happen again?</p>