Module: Bridgetown::Commands::GitHelpers

Included in:
New, Plugins
Defined in:
lib/bridgetown-core/commands/concerns/git_helpers.rb

Instance Method Summary collapse

Instance Method Details

#destroy_existing_repoObject



11
12
13
# File 'lib/bridgetown-core/commands/concerns/git_helpers.rb', line 11

def destroy_existing_repo
  run "rm -rf .git"
end

#initialize_new_repoObject



6
7
8
9
# File 'lib/bridgetown-core/commands/concerns/git_helpers.rb', line 6

def initialize_new_repo
  run "git init", abort_on_failure: true
  `git symbolic-ref HEAD refs/heads/main` if user_default_branch.empty?
end

#user_default_branchObject



15
16
17
# File 'lib/bridgetown-core/commands/concerns/git_helpers.rb', line 15

def user_default_branch
  @user_default_branch ||= `git config init.defaultbranch`.strip
end