Skip to content

Instantly share code, notes, and snippets.

View alexschwartz's full-sized avatar

Alex Schwartz alexschwartz

View GitHub Profile
@alexschwartz
alexschwartz / gist:829676
Created February 16, 2011 16:35
GIT Knowhow - How to replace branches with tags?
## Given a git repo with at least one branch (for example "tags/A")
## which should be transformed into a tag
for t in `git branch -r | grep tags | perl -pi -e "s/origin\///"`; do
echo ============================ $t ;
REV=`git log -1 --pretty=%h origin/$t`;
COMMENT=`git log -1 --pretty=%s origin/$t`;
TAG=`echo $t | cut -d'/' -f2`;
echo $t .. $REV .. $COMMENT .. $TAG;
git tag -a $TAG -m "$COMMENT" $REV;
@alexschwartz
alexschwartz / pom.xml
Created November 16, 2010 23:06
Using a smart build number (Maven2 pom.xml)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>${smartBuildNumber}</version>
....
<build>