Git Tips

clone from github behind an evil firewall

Standard:

git clone [email protected]:yogsototh/project.git

Using HTTPS port:

git clone git+ssh://[email protected]:443/yogsototh/project.git

clone all branches

git clone can only fetch the master branch.

If you don’t have much branches, you can simply use clone your project and then use the following command:

git branch –track local_branch remote_branch
for example:
$ git clone [email protected]:yogsototh/example.git $ git branch master $ git branch -a master remotes/origin/HEAD -> origin/master remotes/origin/experimental $ git branch –track experimental remotes/origin/experimental $ git branch master * experimental

If you have many branches it can be useful to use the following script/long command line.

# first clone your project $ git clone [email protected]:yogsototh/project.git

copy all branches

$ zsh $ cd project $ for br in $( git br -a ); do case $br in remotes/) print $br ; case ${br:t} in master|HEAD) continue ;; ) git branch –track ${br:t} $br ;; esac ;; esac done
Published on 2010-03-22
Follow @yogsototh
Yann Esposito©
Done with Vim spacemacs & nanoc Hakyll

ADA: DdzFFzCqrhtAvdkmATx5Fm8NPJViDy85ZBw13p4XcNzVzvQg8e3vWLXq23JQWFxPEXK6Kvhaxxe7oJt4VMYHxpA2vtCFiP8fziohN6Yp