+ # Make tracking branch
+ git checkout -f "branches/${branch}"
+
+ # Adjusting git tree to specific commit specified in
+ # .hgsubstate:
+ # The SHA from hg and git are not the same, therefore, we must
+ # find the commit sequence in hg and map this
+ # to a hash in git using the ${num} variable:
+ git_rev=$(git log --oneline | sed -n "${num}p" | awk '{print $1}')
+ git reset --hard ${git_rev}
+ fi
+
+ cd ..
+
+ if ! grep -q "${dest}" .gitignore ; then
+ # Ignore subrepo in top-level git repository
+ echo "${dest}" >> .gitignore