2010-04-29 13:43:21 +00:00
|
|
|
-----
|
2010-04-15 09:20:27 +00:00
|
|
|
isHidden: false
|
|
|
|
menupriority: 1
|
|
|
|
kind: article
|
|
|
|
created_at: 2010-03-22T10:42:27+02:00
|
|
|
|
title: Git Tips
|
2010-05-09 12:53:46 +00:00
|
|
|
author_name: Yann Esposito
|
|
|
|
author_uri: yannesposito.com
|
2010-04-15 09:20:27 +00:00
|
|
|
tags:
|
|
|
|
- git
|
|
|
|
- tip
|
|
|
|
-----
|
|
|
|
|
|
|
|
## clone from github behind an evil firewall
|
|
|
|
|
|
|
|
Standard:
|
|
|
|
|
|
|
|
<div><code class="zsh">
|
|
|
|
git clone git@github.com:yogsototh/project.git
|
|
|
|
</code></div>
|
|
|
|
|
|
|
|
Using HTTPS port:
|
|
|
|
|
|
|
|
<div><code class="zsh">
|
|
|
|
git clone git+ssh://git@github.com:443/yogsototh/project.git
|
|
|
|
</code></div>
|
|
|
|
|
|
|
|
## 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:
|
|
|
|
|
|
|
|
<div><code class="zsh">
|
|
|
|
git branch --track local_branch remote_branch
|
|
|
|
</code></div>
|
|
|
|
|
|
|
|
for example:
|
|
|
|
<div><code class="zsh">
|
|
|
|
$ git clone git@github: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
|
|
|
|
</code></div>
|
|
|
|
|
|
|
|
If you have many branches it can be useful to use the following *script*/*long command line*.
|
|
|
|
|
|
|
|
<div><code class="zsh">
|
|
|
|
# first clone your project
|
|
|
|
$ git clone git@github.com: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
|
|
|
|
</code></div>
|