Skip to content

Commit 331b628

Browse files
committed
init commit
0 parents  commit 331b628

8 files changed

+170
-0
lines changed

.gitignore

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
$RECYCLE.BIN/
2+
*.bin
3+
*.cab
4+
*.icloud
5+
*.lnk
6+
*.msi
7+
*.msix
8+
*.msm
9+
*.msp
10+
*.stackdump
11+
*~
12+
.AppleDB
13+
.AppleDesktop
14+
.AppleDouble
15+
.DS_Store
16+
.DocumentRevisions-V100
17+
.LSOverride
18+
.Spotlight-V100
19+
.TemporaryItems
20+
.Trash-*
21+
.Trashes
22+
.VolumeIcon.icns
23+
._*
24+
.apdisk
25+
.com.apple.timemachine.donotpresent
26+
.directory
27+
.fseventsd
28+
.fuse_hidden*
29+
.nfs*
30+
Icon
31+
32+
33+
Network Trash Folder
34+
Temporary Items
35+
Thumbs.db
36+
Thumbs.db:encryptable
37+
[Dd]esktop.ini
38+
ehthumbs.db
39+
ehthumbs_vista.db

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Kamaran Layne
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# git-extensions

git-branch-checkout

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
((!$#)) && {
4+
echo Error: no branch name provided
5+
exit 1
6+
}
7+
8+
(($# > 1)) && {
9+
echo Error: too many arguments
10+
exit 1
11+
}
12+
13+
git branch "$1" &&
14+
git checkout "$1" &&
15+
git branch
16+
17+
exit $?

git-delete-tag

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
3+
((!$#)) && {
4+
echo Error: no args provided
5+
exit 1
6+
}
7+
8+
! git describe --tags --abbrev=0 >/dev/null 2>&1 && {
9+
echo Error: no tags available
10+
exit 1
11+
}
12+
13+
pos=()
14+
del=false
15+
16+
shopt -s extglob
17+
while (($#)); do
18+
case "$1" in
19+
-[1-9]*([0-9]))
20+
tags=($(git tag | tail -n"$1"))
21+
;;
22+
-f | --force)
23+
del=true
24+
;;
25+
*)
26+
pos+=("$1")
27+
;;
28+
esac
29+
shift
30+
done
31+
shopt -u extglob
32+
33+
((${#pos[@]})) &&
34+
tags=(${pos[@]})
35+
36+
! $del && {
37+
for tag in "${tags[@]}"; do
38+
printf "%-21s%s\n" " - [ ]" "$tag"
39+
done
40+
41+
read -p "Completely delete $(
42+
((${#tags[@]} > 1)) &&
43+
echo these tags ||
44+
echo this tag
45+
) (local & remote)? (Y/n): " answer
46+
if [[ "$answer" =~ ^([yY]([eE][sS])?)$ ]]; then
47+
del=true
48+
else
49+
echo No tags have been deleted
50+
exit 1
51+
fi
52+
}
53+
54+
$del && {
55+
for tag in "${tags[@]}"; do
56+
git tag -d "$tag" &&
57+
git push origin :"$tag"
58+
done
59+
}

git-save

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
git add -A &&
4+
git commit -m "saved $(date +"%Y-%m-%d %H:%M:%S")"
5+
6+
exit $?

git-tag-latest

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
git tag -f -a latest -m latest &&
4+
git log -1 latest
5+
6+
exit $?

git-tag-version

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
((!$#)) && {
4+
echo Error: no semver provided
5+
exit 1
6+
}
7+
8+
(($# > 1)) && {
9+
echo Error: too many arguments
10+
exit 1
11+
}
12+
13+
[[ ! $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z]+(\.)?[0-9]+)?$ ]] && {
14+
echo Error: invalid semver
15+
exit 1
16+
}
17+
18+
git tag -a "v$1" -m "v$1" &&
19+
git log -1 "v$1"
20+
21+
exit $?

0 commit comments

Comments
 (0)