-
Notifications
You must be signed in to change notification settings - Fork 210
/
gitwiz
executable file
·50 lines (41 loc) · 1.47 KB
/
gitwiz
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
#!/usr/bin/env perl
use Modern::Perl;
my ($action, $name) = @ARGV;
if (not $action) {
say "action needed";
exit;
}
if (not $name) {
say "name needed";
exit;
}
given ($action) {
# May branch off from: devel
# Must merge back into: devel
# Branch naming convention: anything except master, devel, release-*, or
# hotfix-*
#
# Feature branches (or sometimes called topic branches) are used to develop new
# features for the upcoming or a distant future release. When starting
# development of a feature, the target release in which this feature will be
# incorporated may well be unknown at that point. The essence of a feature
# branch is that it exists as long as the feature is in development, but will
# eventually be merged back into devel (to definitely add the new feature to
# the upcoming release) or discarded (in case of a disappointing experiment).
#
# Feature branches typically exist in developer repos only, not in origin.
when ('new-feature') {
if ($name =~ /^(master|devel|release-.*|hotfix-.*)$/ms) {
say "invalid feature name: '$1'";
exit 1;
}
if (system("git checkout -b $name devel") != 0) {
say "ERROR: unable to branch from devel";
exit 2;
}
say "opened feature '$name', run 'gitwiz close-feature $name' when done"
}
default {
say "No such action: '$action'";
}
}