diff --git a/src/git.cpp b/src/git.cpp index 654644f..59be8e7 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -113,6 +113,7 @@ void create_branch() { const auto id{get_last_id() + 1}; const string branch_name = "web-" + std::to_string(id); + const string ref_name{"refs/heads/" + branch_name}; git_oid oid_parent; git_commit *commit; @@ -125,6 +126,8 @@ void create_branch() git_reference *branch; // Create new branch. check(git_branch_create(&branch, _repo, branch_name.c_str(), commit, 0)); + + check(git_repository_set_head(_repo, ref_name.c_str())); } void commit(const entry_type &entry)