git - 以编程方式获取远程用于 git push
解决方案
答案不像获取那么简单,因为有一个需要考虑的后备列表:
这些别名考虑了以上所有内容:
branch-name = "symbolic-ref --short HEAD" # https://stackoverflow.com/a/19585361/5353461
branch-remote-fetch = !"branch=$(git branch-name \"$1\") && git config branch.\"$branch\".remote || echo origin #"
branch-remote-push = !"branch=$(git branch-name \"$1\") && git config branch.\"$branch\".pushRemote || git config remote.pushDefault || git branch-remote-fetch #"
而且,作为奖励,对于 URL:
branch-url-push = !"remote=$(git branch-remote-push \"$1\") && git remote get-url --push \"$remote\" #" # cognizant of pushInsteadOf
推荐阅读
- arrays - 如何识别 Swift 数组中特定值的连续出现?
- uno-platform - 如何将类库项目添加到 Uno-Platform?
- asp.net-mvc - 为 ASP.NET MVC 5 项目设计更复杂的数据库
- java - 是否可以强制转换方法?
- swift - 插入的模型看起来比预期的大并且在相机的背面
- python - 使用 Keras 的慢 DQN
- python - 如何将具有每日收益的数据框转换为从 100 开始的数据框索引
- c - TCP/IP 流转储任意簇中的文本(C 套接字编程)
- python - 如何在小复杂度模型(LBCNN)上解决 Pytorch “CUDA out of memory”
- amazon-web-services - 针对 PCI DSS 的 Elastic Beanstalk 的内部漏洞扫描和笔测试