-
Notifications
You must be signed in to change notification settings - Fork 0
/
ox-cli-git.ps1
executable file
·36 lines (31 loc) · 965 Bytes
/
ox-cli-git.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
##########################################################
# config
##########################################################
# default files
$Global:OX_OXYGEN.oxg = "$env:OXIDIZER\defaults\.gitconfig"
# system files
$Global:OX_ELEMENT.g = "$HOME\.gitconfig"
##########################################################
# repository management
##########################################################
function get_default_branch() {
git remote show origin | grep 'HEAD branch' | cut -d ' ' -f5
}
# git republish
function grpbl() {
git remote add origin $args[0]
$dbranch = $(get_default_branch)
git pull $args[0] $dbranch
git push --set-upstream origin $dbranch
}
# clean files
function gcl {
git reset --hard HEAD~1
$dbranch = $(get_default_branch)
git checkout --orphan origin/$dbranch
git add -A
git commit -am "🎉 New Start"
git branch -D $dbranch
git branch -m $dbranch
git push -f origin $dbranch
}