Skip to content

Instantly share code, notes, and snippets.

@OndrejP
Created November 7, 2014 11:20
Show Gist options
  • Save OndrejP/9401f9fdd50413447e0c to your computer and use it in GitHub Desktop.
Save OndrejP/9401f9fdd50413447e0c to your computer and use it in GitHub Desktop.
Short way to create release tag
function git.releaseID {
test $(date --reference=${HOME}/.git.releaseid +"%j" 2>/dev/null || echo 389) -ne $(date +"%j") \
&& echo -n 1 >~/.git.releaseid \
|| echo $(($(cat ~/.git.releaseid)+1)) >~/.git.releaseid ;
cat ~/.git.releaseid ;
}
function WikidiRelease {
r=$(date +"%Y%m%d").$(git.releaseID);
git tag release/$r;
git push origin release/$r;
}
@pracj3am
Copy link

pracj3am commented Nov 7, 2014

function WikidiRelease {
 d="release/"`date +"%Y%m%d"`;
 r=$((`git tag -l "$d*" | sed -n 's/^.*\.\([0-9]\+\)$/\1/p' || echo 0`+1))
 git tag $d.$r;
 git push origin $d.$r;
}

@OndrejP
Copy link
Author

OndrejP commented Nov 7, 2014

function WikidiRelease {
d="release/"date +"%Y%m%d";
r=$((git tag -l "$d*" | sed -n 's/^.*\.\([0-9]\+\)$/\1/p' | sort -n | tail -n 1 || echo 0+1))
git tag $d.$r;
git push origin $d.$r;
}

@pracj3am
Copy link

pracj3am commented Nov 7, 2014

function WikidiRelease {
 d="release/"`date +"%Y%m%d"`;
 r=$((`git tag -l "$d*" | sort -rV | head -1 | sed -n "s@^$d\.@@p" || echo 0`+1))
 git tag $d.$r;
 git push origin $d.$r;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment