-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGitEnvironment.ps1
113 lines (101 loc) · 2.33 KB
/
GitEnvironment.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# $pGitPath = "C:\Program Files\Git"
# $env:PATH = "$env:PATH;$pGitPath\cmd;$pGitPath\bin;$pGitPath\mingw\bin;";
# Import posh-git and load example profile
Import-Module posh-git
. (Resolve-Path "$env:powershell\Modules\posh-git\profile.example.ps1")
# ALIASES FOR GIT
function Git-Branch($1, $2) {
git branch $1 $2;
}
function Git-Checkout ($branch) {
git checkout $branch;
}
function Git-Store-WIP ($message) {
git add -A;
git commit -m wip;
}
function Git-Delete-Branch($branch) {
git branch -d $branch;
}
function Git-Unsafe-Delete-Branch($branch) {
git branch -D $branch;
git push --delete origin $branch
}
function Git-Obliterate-Branch($branch) {
git branch -D $branch;
git push --delete origin $branch
}
function Git-Log {
git log
}
function Git-Log-Summary {
git log --pretty=format:"%h - %an, %ar : %s"
}
function Git-Main {
git stash;
git checkout main;
git pull;
}
function Git-New-Branch ($branch) {
git checkout -b $branch;
}
function Git-Pull ($remote, $branch) {
git pull $remote $branch;
}
function Git-Push ($remote, $branch, $arg) {
git push --set-upstream $remote $branch $arg;
}
function Git-Shove ($remote, $branch, $arg) {
git push --set-upstream $remote $branch $arg --force;
}
function Git-Rebase($branch) {
if ($branch) {
git rebase $branch;
}
else {
git rebase main;
}
}
function Git-Restore ($arg) {
git stash apply $arg;
}
function Git-Reset ($1, $2, $3) {
git reset $1 $2 $3;
}
function Git-Undo {
git reset HEAD^;
}
function Git-Stash () {
git add -A;
git stash;
}
Set-Alias gut git
Set-Alias got git
Set-Alias branch Git-Branch
Set-Alias br Git-Branch
Set-Alias dbranch Git-Delete-Branch
Set-Alias db Git-Delete-Branch
Set-Alias killbranch Git-Unsafe-Delete-Branch
Set-Alias kb Git-Unsafe-Delete-Branch
Set-Alias newbranch Git-New-Branch
Set-Alias nb Git-New-Branch
Set-Alias fuckyobranch Git-Obliterate-Branch
Set-Alias fyb Git-Obliterate-Branch
Set-Alias checkout Git-Checkout
Set-Alias co Git-Checkout
Set-Alias log Git-Log
Set-Alias summary Git-Log-Summary
Set-Alias main Git-Main
Set-Alias pull Git-Pull
Set-Alias push Git-Push
Set-Alias shove Git-Shove
Set-Alias rebase Git-Rebase
Set-Alias stash Git-Stash
Set-Alias reset Git-Reset
Set-Alias restore Git-Restore
Set-Alias wip Git-Store-WIP
Set-Alias undo Git-Undo
function Rap-Stats ($since) {
node stats.js --since $since
}
Set-Alias stats Rap-Stats