module Git::Commands::Checkout
Commands for switching branches and restoring files via βgit checkout`
This module contains command classes split by checkout mode:
-
{Checkout::Branch} β switch branches or create and switch to a new branch
-
{Checkout::Files} β restore working tree files from a given tree-ish
@example Switch to an existing branch
cmd = Git::Commands::Checkout::Branch.new(lib) cmd.call('main')
@example Create and switch to a new branch
cmd = Git::Commands::Checkout::Branch.new(lib) cmd.call('main', b: 'feature/new-feature')
@example Restore a file from the index (discard uncommitted changes)
cmd = Git::Commands::Checkout::Files.new(lib) cmd.call(pathspec: ['lib/my_file.rb'])
@example Restore a file from a specific branch
cmd = Git::Commands::Checkout::Files.new(lib) cmd.call('main', pathspec: ['lib/my_file.rb'])
@see git-scm.com/docs/git-checkout git-checkout documentation
@api private