From 4034ab0b6ac8784306d717d12451dc12e3c32ae2 Mon Sep 17 00:00:00 2001 From: Jannik Beyerstedt Date: Mon, 25 Nov 2024 14:16:37 +0100 Subject: [PATCH] zshrc: Add shortcut to "move" git tags --- tasks/usersettings.yml | 2 +- templates/_zshrc.j2 | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tasks/usersettings.yml b/tasks/usersettings.yml index 4789795..ed01d40 100644 --- a/tasks/usersettings.yml +++ b/tasks/usersettings.yml @@ -113,7 +113,7 @@ - { src: "{{ role_path }}/templates/htoprc.j2", dest: "{{ ansible_user_dir }}/.config/htop/htoprc", - force: no, + force: false, } - name: Usersettings - Set global gitconfig when: usersetup_gitconfig == true diff --git a/templates/_zshrc.j2 b/templates/_zshrc.j2 index e866e9c..b5edc62 100644 --- a/templates/_zshrc.j2 +++ b/templates/_zshrc.j2 @@ -107,6 +107,19 @@ alias doch='sudo sh -c "$(fc -n -l -- -1)"' alias git-reset-pull='git fetch && git reset --hard origin/$(git rev-parse --abbrev-ref HEAD)' alias git-force-push='git push origin $(git rev-parse --abbrev-ref HEAD) --force-with-lease' +git_retag() { + # delete specified tag, add to current HEAD again and push + remote="origin" + if [ "$#" -ge "2" ]; then + remote=$2; + fi + if [ "$#" -ge "1" ]; then + echo "git tag -d $1 && git push $remote :$1 && git tag $1 && git push $remote $1" + else + echo "ERROR: Please provide a tag name and optionally a remote name (default = 'origin')" + fi +} + # mpv alias mpv="mpv --autofit=70%"