[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/QuantStack/git2cpp/0.0.12/src/subcommand/checkout_subcommand.cpp [Back]  [Original]

#include "../subcommand/checkout_subcommand.hpp"

#include 
#include 
#include 

#include 

#include "../subcommand/status_subcommand.hpp"
#include "../utils/git_exception.hpp"
#include "../wrapper/repository_wrapper.hpp"
#include "../wrapper/status_wrapper.hpp"

checkout_subcommand::checkout_subcommand(const libgit2_object&, CLI::App& app)
{
    auto* sub = app.add_subcommand("checkout", "Switch branches or restore working tree files");

    sub->add_option(
        "",
        m_positional_args,
        "Tree-ish to checkout, and/or one/many pathspec(s)\ne.g. checkout , checkout , checkout  ..., checkout   ...\nNote: use without '--'"
    );
    sub->add_flag("-b", m_create_flag, "Create a new branch before checking it out");
    sub->add_flag("-B", m_force_create_flag, "Create a new branch or reset it if it exists before checking it out");
    sub->add_flag(
        "-f, --force",
        m_force_checkout_flag,
        "When switching branches, proceed even if the index or the working tree differs from HEAD, and even if there are untracked files in the way"
    );

    sub->callback(
        [this]()
        {
            this->run();
        }
    );
}

namespace
{
    void print_no_switch(status_list_wrapper& sl)
    {
        std::cout 

Web Proxy Viewer  |  New URL  |  Original Page