Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


I found myself weary of typing ./ or ../ or ../../ etc to get to ./bin/g
an immediate solution is to make an alias with the full path
alias g='/home/me/git/oo/build/bin/g'
but that imply that you have only one git clone... and I have 2 (one
to work in, the other one to build pristine git pull while I mess with
the first view

so:
I created find-lo-bin, which I put in a directory in my PATH

#!/bin/bash

current_dir=`pwd`

# go up the chain until you find a .git
while [ ${current_dir} != "/" -a -d "${current_dir}" -a ! -d
"${current_dir}/.git" ] ;
do
    current_dir=$(dirname "${current_dir}")
done

# if you are in a git repo under clone, go 2 more steps up
if [ $(basename $(dirname ${current_dir})) = "clone" ] ; then
    current_dir=$(dirname $(dirname "${current_dir}"))
fi

echo "${current_dir}/bin"
unset current_dir
---------------

and then

I added in my .bashrc

alias g='$(find-lo-bin)/g'

The other thing that I find myself repeatedly doing is to run the same
git command on
the root repo and on all the others via ./bin/g

'ga' is a little script take care of that:

#!/bin/bash

cd $(find-lo-bin)/..
if [ "$1" = "-f" ] ; then
    shift
    git "$@"
    ./bin/g -f "$@"
else
    git "$@" && ./bin/g "$@"
fi
cd -


Norbert

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.