git 相關

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_PROXY
unset HTTPS_PROXY
git config --global --unset http.proxy
git config --global --unset https.proxy
git clone http://yourUser@stashAddress:stashPort/apptest.git

To define proxies again:

export HTTP_PROXY=proxyaddress:port
export HTTPS_PROXY=proxyaddress:port
git config --global http.proxy http://proxyaddress:port
git 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

參考:https://www.atlassian.com/git/tutorials/git-log

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章