forked from mugishap/commit-time-travel-machine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.sh
More file actions
executable file
·35 lines (30 loc) · 846 Bytes
/
index.sh
File metadata and controls
executable file
·35 lines (30 loc) · 846 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
30
31
32
33
34
35
#!/usr/bin/env sh
_() {
printf "YEAR: "
read -r YEAR
printf "GitHub Username: "
read -r USERNAME
printf "GitHub repository: "
read -r REPO
printf "GitHub Access token: "
read -r ACCESS_TOKEN
[ -z "$USERNAME" ] && exit 1
[ -z "$ACCESS_TOKEN" ] && exit 1
[ ! -d $YEAR ] && mkdir $YEAR
cd "${YEAR}" || exit
git init
echo "**${YEAR}** - Generated by https://github.com/mugishap/commit-time-travel-machine" \
>README.md
git add .
GIT_AUTHOR_DATE="${YEAR}-01-01T18:00:00" \
GIT_COMMITTER_DATE="${YEAR}-01-01T18:00:00" \
git commit -m "${YEAR}"
git remote add origin "https://${ACCESS_TOKEN}@github.com/${USERNAME}/${REPO}.git"
git branch -M main
git push -u origin main -f
cd ..
rm -rf "${YEAR}"
echo
echo "Cool, check your profile now: https://github.com/${USERNAME}"
} && _
unset -f _