module Git::Commands::Checkout

Commands for switching branches and restoring files via β€˜git checkout`

This module contains command classes split by checkout mode:

@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