Git-奇淫巧技

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

Others

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱学习的卡比兽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值