diff --git a/scripts/common.sh b/scripts/common.sh
index 6c306d6971fd6f70ce685b1eff0a348222a2ffc5..7f59765103b7030294603465840ce7f0848cbe1c 100755
--- a/scripts/common.sh
+++ b/scripts/common.sh
@@ -12,10 +12,16 @@ function get_sources() {
 
 # $1: source package name
 # $2: git repository
+# $3: (optional) specifc branch or tag
 function get_git_sources() {
 	git clone $2 $1
 	cd $1
-	git tag --sort "version:refname" -l | tail -n1 | xargs git checkout
+	if [[ ! -z $3 ]] # checks if $3 is not empty
+	then 
+		git checkout $3
+	else
+		git tag --sort "version:refname" -l | tail -n1 | xargs git checkout
+	fi
 }
 
 # $1: patch directory name