1 下载github 上,主分支以外的其他分支

"checkout" the remote branch as a new local branch, and specify a new local branch name.

git checkout -b newlocalbranchname origin/branch-name

Or you can do:

git checkout -t origin/branch-name

The latter will create a branch that is also set to track the remote branch.

2 ubuntu下载android 源码时,出现错误:Received HTTP code 503 from proxy after CONNECT

解决方案:

unset HTTP_PROXYunset HTTPS_PROXYgit config --global --unset http.proxygit config --global --unset https.proxygit clone http://yourUser@stashAddress:stashPort/apptest.git

To define proxies again:

export HTTP_PROXY=proxyaddress:portexport HTTPS_PROXY=proxyaddress:portgit config --global http.proxy http://proxyaddress:portgit config --global https.proxy http://proxyaddress:port

3 更改项目下所有分支:

repo start preview2 refs/tags/android-o-preview-2 --all

 

repo start oreo-cts-release remotes/aosp/oreo-cts-release  --all

一次把所有project都切換到別的branch

        repo forall -c git checkout [BRANCH_NAME]

4 列出所有远程分支tag

git ls-remote --tags

5 repo init 下载代码时,503 error, and ping 8.8.8.8 or ping goole.com unknown host :

  1. Edit /etc/network/interfaces:

    sudo nano /etc/network/interfaces
  2. Below iface eth0 inet static add the following line:

    dns-nameservers 8.8.8.8 8.8.4.4

    This will use Google's DNS servers.

  3. Restart your network:

    sudo /etc/init.d/networking restart

6 repo sync 下错分支怎么办:

If you run repo init a second time with a different branch, you can simply repo sync and it will not download the entire source code again.

7 add git log to files: 保存git 提交log到文件中

git log --after="2017-6-30" > log_630.txt

參考: