mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 19:46:54 +00:00
9 lines
256 B
Python
9 lines
256 B
Python
# -*- coding: utf-8 -*-
|
|
import subprocess
|
|
|
|
|
|
def get_current_branch_name():
|
|
output = subprocess.check_output(['git', 'symbolic-ref', 'HEAD'])
|
|
output = output.splitlines()
|
|
head_branches = output[0]
|
|
return head_branches.strip().split('/')[-1]
|