improves home default configuration
This commit is contained in:
parent
dd4d936974
commit
babc91e50f
7 changed files with 479 additions and 22 deletions
66
profile/airootfs/root/content/home/.local/bin/tag
Executable file
66
profile/airootfs/root/content/home/.local/bin/tag
Executable file
|
@ -0,0 +1,66 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
BLUE="\033[0;34m"
|
||||
WHITE="\033[1;37m"
|
||||
RESET="\033[0m"
|
||||
log() { echo -e "$BLUE [tag]" $@ "$RESET" ; }
|
||||
|
||||
|
||||
if [ $# -lt 1 ] || [ $1 = "-h" ] || [ $1 = "--help" ]
|
||||
then
|
||||
echo "tag - Crée ou tag un commit et le push.
|
||||
Usage:
|
||||
tag <suffix>
|
||||
|
||||
Arguments:
|
||||
suffix Suffix du 'tag' appliqué.
|
||||
|
||||
Exemple:
|
||||
git add -A
|
||||
tag exercise-epiTinderDB-
|
||||
# Crée un commit avec le tag 'exercise-epiTinderDB-1709847215'
|
||||
# et le push.
|
||||
|
||||
Crée un commit contenant tout les changements ajoutés 'git add'.
|
||||
Et 'tag' ce commit avec un certain suffix et un id généré.
|
||||
|
||||
Le message de commit est 'tag - $(date +"%d/%m/%Y %H:%M")'.
|
||||
Le tag sur le commit est '<suffix><nombre aléatoire>'.
|
||||
|
||||
Auteur:
|
||||
Matthieu JOLIMAITRE <matthieu@imagevo.fr>
|
||||
"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
suffix="$1"
|
||||
message="tag - $(date +"%d/%m/%Y %H:%M")"
|
||||
tag_name="$suffix$(date +"%s")"
|
||||
|
||||
alias is_git_repo="git rev-parse 2> /dev/null"
|
||||
if ! is_git_repo
|
||||
then
|
||||
log "Not a git repository."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
log "Checking for staged changes ..."
|
||||
alias is_content_staged="! git diff --cached --quiet"
|
||||
if is_content_staged
|
||||
then
|
||||
log "Committing staged changes."
|
||||
git commit --message "$message"
|
||||
fi
|
||||
|
||||
|
||||
log "Tagging commit with tag $WHITE$tag_name$BLUE ..."
|
||||
git tag --annotate "$tag_name" --message "$message"
|
||||
|
||||
|
||||
log "Pushing commits ..."
|
||||
git push --follow-tags
|
||||
|
||||
|
||||
log "Done."
|
Loading…
Add table
Add a link
Reference in a new issue