Using drush, individual migrations can be imported and then rolled back. Running processes can be cleanly interrupted, individual source records can be migrated on their own, and performance can be instrumented.

drush list --filter=migrate provides a complete list of relevant commands.
Use drush help --filter=migrate for Drush < 9.

All commands

migrate-analyze (maz) Analyze the source fields for a migration.
migrate-audit (ma) View information on problems in a migration.
migrate-register (mreg) Register or re-register any statically defined migrations.
migrate-deregister Remove all tracking of a migration
migrate-fields-destination (mfd) List the fields available for mapping in a destination.
migrate-fields-source (mfs) List the fields available for mapping from a source.
migrate-import (mi, mim) Perform one or more migration processes
migrate-mappings (mm) View information on all field mappings in a migration.
migrate-messages (mmsg) View any messages associated with a migration.
migrate-reset-status (mrs) Reset an active migration's status to idle
migrate-rollback (mr) Roll back the destination objects from a given migration
migrate-status (ms) List all migrations with current status.
migrate-stop (mst) Stop an active migration operation
migrate-wipe (mw) Delete all nodes from specified content types.

For examples on the options type:
drush help <command>

Help:
drush mim --help

Examples

migrate-import Article
Import new articles

migrate-import Article --update
Import new items, and also update previously-imported items

migrate-import Article --idlist=4,9
Import two specific articles. The ids refer to the value of the primary key in base table.
This allows you to cherry-pick specific, individual source records to migrate (so you don't have to sit through an entire migration whilst debugging) with, for example: drush mim LibraryDocument --idlist=48,52,108 to pull in only items with ids 48,52, and 108

migrate-import Article --limit="60 seconds" --stop --rollback
Import for up to 60 seconds after stopping and rolling back the Article migration.

migrate-import Article --limit="100 items"
Import up to 100 items from the migration named Article.*

migrate-import User --feedback="1000 items"
Display a progress message every 1000 processed items or less*

*NOTE: You cannot use --limit and --feedback at the same time.

migrate-import --all=User
Perform User migrations and all that follow it.

Arguments

migration
Name of migration(s) to import. Delimit multiple using commas.

Options

--all
Process all migrations that come after the specified migration. If no value is supplied, all migrations are processed.

--feedback
Frequency of progress messages, in seconds or items processed

--file_function
Override file function to use when migrating images.

--force
Force an operation to run, even if all dependencies are not satisfied

--group
Name of the migration group to run

--idlist
A comma delimited list of ids to import or rollback. If unspecified, migrate imports all pending items or rolls back all items for the content set.

--instrument
Capture performance information (timer, memory, or all)

--limit
Limit on the length of each migration process, expressed in seconds or number of items

--needs-update
Reimport up to 10K records where needs_update=1. This option is only needed when your Drupal DB is on a different DB server from your source data. Otherwise, these records get migrated with just migrate-import.

--rollback
Rollback specified migration(s) if applicable.

--stop
Stop specified migration(s) if applicable.

--update
In addition to processing unimported items from the source, update previously-imported items with new data

Note

You need to run drush from the directory where the Drupal site is installed.

See also: Drush helps reliable migrate performance by eliminating timeouts and other limitations.

Comments

sandstrom’s picture

Only the following command works with the latest version (8.x-4.0-beta2) of migrate_tools module.

 migrate-fields-source (mfs) - List the fields available for mapping in a source. 
                                                                
 migrate-import (mi, mim) - Perform one or more migration processes.
           
 migrate-messages (mmsg) - View any messages associated with a migration.  
   
 migrate-reset-status (mrs) - Reset a active migration's status to idle.         
                                                                     
 migrate-rollback  (mr) - Rollback one or more migrations.                   
                                                                    
 migrate-status (ms) - List all migrations with current status.     
      
 migrate-stop (mst) - Stop an active migration operation.
KarimBou’s picture

Drush9 and Drupal 8.4.4 or Drupal 8.5.x doesn't work with some of the command above specially migrate-wipe ('mw').

b.khouy’s picture

Hello guys,
I need to clean (delete) a specific migration config with drush.. which option should I use to delete it?
Thanks!

KarimBou’s picture

@BrahimKH

Hello guys,
I need to clean (delete) a specific migration config with drush.. which option should I use to delete it?
Thanks!

You can use: drush mr your_migration
That will delete (called rollback in Migrate) all items, entity created with this migration.

b.khouy’s picture

Thanks dude!
One other question please, imagine I have the following csv source file:
title,date,image
title 1,11-11-2018,https://mydomain.com/images/my_image1.jpg
title 2,12-11-2018,https://mydomain.com/images/my_image2.jpg
...

And I have a content type with those 3 fields: title (text), date(text), image(image).
Image field type is "image" and in the source file image field contains the direct url to the image file, while importing from this csv file drush show this warning:
Missing file with ID https://mydomain.com/images/my_image1.jpg. ImageItem.php:327
Missing file with ID https://mydomain.com/images/my_image2.jpg. ImageItem.php:327
The content is created but the field image still empty..
Is it possible to import images using url?
The same for a field with entity reference as type.

Update

The solution is here: https://www.drupal.org/docs/8/api/migrate-api/migrate-destination-plugin...

kmani’s picture

How to remove following ids permanently

Group Migration ID Status Total Imported Unprocessed Last Imported
------------------- ------------------------ -------- ------- ---------- ------------- ---------------------
blog (blog) blog_csv_images_import Idle 2 2 0 2018-10-23 06:58:55
blog (blog) blog_node Idle 2 0 0 2018-10-22 09:06:00
Default (default) blog_csv_import Idle 2 0 2 2018-10-22 13:43:02

rituraj.gupta’s picture

Hello,

Can you tell me me, If I want to upload CSV through node/add/csv page then How would content migrate with migrate APIs?

Please describe in detail?

Regards,
​​​​​​​Ritu Raj

----------
Warm Regards,
Ritu Raj