Remove stale local branches with where removed on remote server
Installation:
dir=`pwd`
git clone github.com/lhost/scripts-git
cd ~/bin && ln -s $dir/scripts-git/git-gone
'git some-usefull-command' will execute 'git-some-usefull-command' found in your $PATH
cd ~/your/git/repository
git gone
From github.com/lhost/scripts-git
- [deleted] (none) -> origin/old-branch-1
- [deleted] (none) -> origin/some_feature_branch
Simple Perl script to pull all repositories from your Gitlab server.
mkdir -p ~/work/company/git && cd ~/work/company/git
echo ssh://gitlab.company.com > REPO
~/bin/gitlab-fetch-all-repositories.pl
Simple Perl script to pull all repositories from your server. Usefull if your git server is powered by gitolite
mkdir -p ~/work/company/git && cd ~/work/company/git
echo git.company.com > REPO
~/bin/gitolite-pull-all-repositories.pl
The same as gitolite-pull-all-repositories.pl
but do fetch
instead of pull
- fetch all repositories
Gitolite has a great mirroring function. Sometimes you need to mirror all repositories to your slave/backup server.
Simple Perl script to fetch all repositories of specified user from github.com
Clone repositories using HTTPS:
mkdir -p ~/github/lhost && cd ~/github/lhost
echo github.com/lhost > REPO
~/bin/github-fetch-all-repositories.pl
Clone repositories using SSH (clone your own github repos) - use colon ':' instead of slash '/' as seperator between hostname and username:
mkdir -p ~/github/lhost && cd ~/github/lhost
echo github.com:lhost > REPO
~/bin/github-fetch-all-repositories.pl
Simple script to pull all already-cloned repositores in current directory. Search for all .git subdirectories up to level 4.
Search for git repositories in specified directories and export this information as JSON:
./github.com-lhost/scripts-git/git-status.pl ./github.com-lhost/scripts-git
{
"./github.com-lhost/scripts-git" : {
"." : {
"branch" : "master",
"branches" : {
"master" : {
"default" : 1,
"desc" : "Do fetch insteead of pull",
"sha1" : "7bcb147ffdc19e4cb8e2218880554eabdc1f555a"
},
"remotes/origin/HEAD" : {
"default" : 0,
"desc" : "origin/master",
"sha1" : "->"
},
"remotes/origin/master" : {
"default" : 0,
"desc" : "Do fetch insteead of pull",
"sha1" : "7bcb147ffdc19e4cb8e2218880554eabdc1f555a"
}
},
"remotes" : {
"origin" : "https://github.com/lhost/scripts-git.git"
},
"rev" : "7bcb147ffdc19e4cb8e2218880554eabdc1f555a"
}
}
}
Simle installation script
use bootstrap.sh script to create symlinks in your $HOME/bin directory
cd ~/git
git clone https://github.com/lhost/scripts-git
cd scripts-git
./bootstrap.sh
curl -o - https://raw.githubusercontent.com/lhost/scripts-git/master/bootstrap.sh | sh