-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcm.ps1
33 lines (33 loc) · 877 Bytes
/
gcm.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
# $previousStatus = git branch
# $previousStatus = $previousStatus.split('\n')
# $previousBranch = ""
# $targetBranch = "Daily"
$targetRemote = "repo"
$goodStatus = "nothing to commit, working tree clean"
$currentStatus = git status
# For ($i = 0; $i -lt $previousStatus.Count; $i++) {
# If ($($($previousStatus[$i])[0]) -eq '*') {
# $previousBranch = $($($previousStatus[$i]).split(' ')[1])
# }
# }
# # echo $previousBranch
# if ($previousBranch -ne $targetBranch) {
# git checkout $targetBranch
# }
if ($currentStatus.Contains($goodStatus)) {
Write-Output $goodStatus
}
else {
$date = Get-Date
git add *
if ($args.Count -eq 0) {
git commit -a -m "$date"
}
else {
git commit -a -m "$($args[0])"
}
git push $targetRemote
}
# if ($previousBranch -ne $targetBranch) {
# git checkout $previousBranch
# }