How to setup branch tracking when starting local?
Brian May
brian at microcomaustralia.com.au
Tue Feb 7 23:40:12 CET 2012
On 7 February 2012 21:41, Thomas Koch <thomas at koch.ro> wrote:
> #!/bin/sh
> VCSH_REMOTE_BASE=koch.ro:git/vcsh
> vcsh $1 remote add origin $VCSH_REMOTE_BASE/$1.git
Maybe:
#!/bin/sh
VCSH_REMOTE_BASE=koch.ro:git/vcsh
vcsh run "$1" remote git add origin "$VCSH_REMOTE_BASE/$1.git"
vcsh run "$1" remote git push origin master
Note that I wouldn't personally use the shortcuts inside a script -
just in the unlikely case you ever have a repository name that
conflicts with a vcsh command.
Also note that this won't work unless there is something to push.
My script I created to add a new repository looks like (note: I use
unison to sync ~/tree between computers).
--- cut ---
#!/bin/sh
set -ex
NAME="$1"
git init --bare "$HOME/tree/vcsh.repos/$NAME"
vcsh init "$NAME"
vcsh run "$NAME" git remote add origin "~/tree/vcsh.repos/$NAME"
cat << EOF > "$HOME/.config/mr/available.d/$NAME.vcsh"
[\$HOME/.config/vcsh/repo.d/$NAME.git]
checkout = vcsh clone ~/tree/vcsh.repos/$NAME $NAME
EOF
ln -s "../available.d/$NAME.vcsh" "$HOME/.config/mr/config.d"
--- cut ---
This doesn't do the initial push however, because this needs a commit
to work. At least it does make things a bit easier then doing
everything by hand.
--
Brian May <brian at microcomaustralia.com.au>
More information about the vcs-home
mailing list