-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgme.ps1
More file actions
29 lines (28 loc) · 702 Bytes
/
gme.ps1
File metadata and controls
29 lines (28 loc) · 702 Bytes
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
$previousStatus = git branch
$previousStatus = $previousStatus.split('\n')
$previousBranch = ""
$targetRemote = "repo"
$targetBranch = "master"
For ($i = 0; $i -lt $previousStatus.Count; $i++) {
If ($($($previousStatus[$i])[0]) -eq '*') {
$previousBranch = $($($previousStatus[$i]).split(' ')[1])
}
}
# echo $previousBranch
if ($args.Count -eq 0) {
./gcm.ps1
}else {
./gcm.ps1 "$($args[0])"
}
if ($previousBranch -ne $targetBranch) {
git checkout $targetBranch
}
if ($args.Count -eq 0) {
git merge $previousBranch
}else {
git merge $previousBranch -m "$($args[0])"
}
git push $targetRemote
if ($previousBranch -ne $targetBranch) {
git checkout $previousBranch
}