Part-4 :: Sitecore CLI Commands

 In my previous blog,I have explained about the following topics. Please refer those before going through this blog.

Sitecore CLI Commands

Below are the commands that are very useful while working with Sitecore CLI.
  • sitecore --version 🠊  Displays sitecore version
  • dotnet sitecore -h  🠊 Shows CLI usage, options and commands to use 
  • dotnet sitecore plugin list ðŸ Š Displays list of plugins
  • dotnet sitecore plugin add -n <Plugin Name> ðŸ Š To install any addon plugins

Pull Commands

    Pull Command serialize Sitecore items to disk. 
  • dotnet sitecore ser pull ðŸ Š Serializes content items from a Sitecore instance to your file system
  • dotnet sitecore ser pull -i ModuleA ModuleB ðŸ Š Pull Sitecore items from the specific Modules (where modules refers to module namespace) to serialize on disk. 
  • dotnet sitecore ser pull -i tags:[tagA,tagB] ðŸ Š Pull Sitecore items from the modules tagged (where tags refer to name of the included items) to serialized on disk.

  • dotnet sitecore ser pull -i tags:[tagA,tagB] ModuleA  🠊 Pull Sitecore items from the modules tagged as tagA, tagB, and ModuleA to serialized on disk.
  • Similarly we can have similar commands where we can exclude items to get serialize on disk
    • dotnet sitecore ser pull -e tags:[tagA,tagB]
    • dotnet sitecore ser pull -e ModuleA ModuleB
    • dotnet sitecore ser pull -e tags:[tagA,tagB] ModuleA

Push Commands

    Push Command serialize items from disk to Sitecore.
  • dotnet sitecore ser Push  🠊 Serializes content items from disk to your a Sitecore instance
  • dotnet sitecore ser Push -i ModuleA ModuleB  🠊 Push items of the specific Modules (where modules refers to module namespace) to serialize from disk to Sitecore.

  • dotnet sitecore ser Push -i tags:[tagA,tagB]  🠊 Push items of the modules tagged (where tags refer to name of the included items) to serialize from disk to Sitecore.
  • dotnet sitecore ser Push -i tags:[tagA,tagB] ModuleA ðŸ Š Push items from the modules tagged as tagA, tagB, and ModuleA to serialize from disk to Sitecore.
  • Similarly we can have similar commands where we can exclude items to get from serialize disk to Sitecore
    • dotnet sitecore ser Push -e tags:[tagA,tagB]
    • dotnet sitecore ser Push -e ModuleA ModuleB
    • dotnet sitecore ser Push -e tags:[tagA,tagB] ModuleA

Validate Commands

  • dotnet sitecore ser validate  🠊 To address common validation errors.
  • dotnet sitecore ser validate --fix  ðŸ Š Perform potential corrective actions during the validation of serialized items.    

Package Commands

  • dotnet sitecore ser pkg create -o FILE_PATH  🠊  A package was created at the specified FILE_PATH
  • dotnet sitecore ser pkg create -o <name of package>  🠊  Creates a package of serialized content items.
  • dotnet sitecore ser package install -f <name of package>  🠊  Installs a package of serialized content items in a Sitecore instance.
  • dotnet sitecore ser pkg install -f FILE_PATH  🠊  The package FILE_PATH was installed to the Sitecore instance.

Other Useful Commands

  • dotnet sitecore ser watch  ðŸ Š monitors changes to content items in a Sitecore instance and automatically serializes the changes to your file system.
  • sitecore ser diff   ðŸ Š  compares serialization items between source and destination Sitecore instances
  • dotnet sitecore publish  🠊  Publishes all content for the Master database to the Web database.
You can refer other more commands in the Sitecore documentation.

Conclusion

   Sitecore Content Serialization is a powerful mechanism that streamlines development workflows. Leveraging the CLI (Command Line Interface), developers can efficiently manage serialized items. The 'ser' command offers essential sub commands like 'pull', 'push', and 'diff', enabling seamless synchronization between Sitecore instances and local file systems. By installing the serialization plugin, developers gain access to features such as package creation and validation. This serialization can be considered as a replacement for Unicorn and TDS where Code Generation in TDS can also be achieved with the help of Leprechaun code generation tool which will be covered in my other blog, Majorly it doesn't need of any TDS License. In summary, the CLI empowers Sitecore developers to maintain consistency, validate data integrity, and enhance collaboration across projects.

This ends the series for Sitecore serialization using CLI.

Happy Serialization 😀😀

Comments