About Git
廖雪峰 Tutorial:https://www.liaoxuefeng.com/wiki/896043488029600
git clone 速度慢
1、 查找域名对应的ip地址
(base) ➜ ~ nslookup github.global.ssl.fastly.Net
Server: 2408:84fb:314:148::3e
Address: 2408:84fb:314:148::3e#53
Non-authoritative answer:
Name: github.global.ssl.fastly.Net
Address: 69.63.186.31
(base) ➜ ~ nslookup github.com
Server: 2408:84fb:314:148::3e
Address: 2408:84fb:314:148::3e#53
Non-authoritative answer:
Name: github.com
Address: 13.229.188.59
2、 修改hosts文件 ($ sudo vi /etc/hosts
), add the follow lines into ‘hosts’.
# github
69.63.186.31 github.global.ssl.fastly.Net
13.229.188.59 github.com
3、 刷新DNS缓存
$ sudo killall -HUP mDNSResponder
配置别名
$ git config --global alias.st status
$ git config --global alias.co checkout
$ git config --global alias.ci commit
$ git config --global alias.br branch
$ git config --global alias.unstage 'reset HEAD'
$ git config --global alias.last 'log -1'
...
git修改分支名称
远程分支重命名 (已经推送远程-假设本地分支和远程对应分支名称相同)
$ git branch -m <oldName> <newName> # a. 重命名远程分支对应的本地分支
$ git push --delete origin <oldName> # b. 删除远程分支
$ git push origin <newName> # c. 上传新命名的本地分支
$ git branch --set-upstream-to origin/<newName> # d.把修改后的本地分支与远程分支关联
Remove .DS_Store
$ echo .DS_Store >> .gitignore