Mac开发常用命令整理

常用命令整理

1.Git

代理

  1. 设置代理:
    - 适用http

    	git config --global http.proxy http://xxx.xxx.xxx.xxx:xxxx
    	
    	git config --global https.proxy https://xxx.xxx.xxx.xxx:xxxx
    
     - 适用socks5
    
    	git config --global http.proxy 'socks5://xxx.xxx.xxx.xxx:xxxx' 
    	
    	git config --global https.proxy 'socks5://xxx.xxx.xxx.xxx:xxxx'
    
  2. 查看代理

    	git config --global --get http.proxy
    	 
    	git config --global --get https.proxy
    
  3. 取消代理

    	git config --global --unset http.proxy
    	
    	git config --global --unset https.proxy
    
  4. 美妙的语句

    git clean
    git reflog
    

需要注意的是,如果clean掉的东西没有branch的话,那reflog也没有任何卵用

2.SVN

如果只想下载用户在Github上仓库里的某一个文件夹,git并不支持这一功能。但github上的每一个git版本库都可以使用svn来操作,而svn是支持部分检出的,所以我们可以使用svn来下载。
例如:

  1. 在github上点开这个目录,浏览器地址栏可以得到这个地址:
    https://github.com/CSSEGISandData/COVID-19/tree/master/who_covid_19_situation_reports/who_covid_19_sit_rep_time_series
  2. 将上面地址里的tree/master换成trunk,然后用svn co检出
svn co https://github.com/CSSEGISandData/COVID-19/trunk/who_covid_19_situation_reports/who_covid_19_sit_rep_time_series

参考链接:
https://www.cnblogs.com/wwct/p/12235562.html
https://blog.csdn.net/omgkill/article/details/81903279
https://blog.csdn.net/u013401853/article/details/54879966

2.Homebrew

一些小技巧

  1. 取消homebrew更新(临时有效)
	 export HOMEBREW_NO_AUTO_UPDATE=true

更换homebrew源

  1. 更换homebrew源
  • 替换brew.git
	cd "$(brew --repo)"
	git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
  • 替换homebrew-core.git
	cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
	git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  • 替换Homebrew 核心软件仓库的地址。
	cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
	git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  1. 切回官方源
  • 重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
  • 重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git

一些常见bug

1.Another active Homebrew process is already in progress

rm -rf /usr/local/var/homebrew/locks

参考链接:
https://www.jianshu.com/p/9592826c254b
https://blog.csdn.net/tzjvon/article/details/79648825
https://blog.csdn.net/tzjvon/article/details/79648825

猜你喜欢

转载自blog.csdn.net/Cindy_00/article/details/105652844