git 有用的命令

git 有用的命令

  • 指定标签创建分支
git checkout -b 分支名 tagname
  • 基于远程分支创建
git checkout -b 分支名 origin/远程分支名 
  • 指定提交创建分支
git checkout -b 分支名 commitid
  • 克隆仓库目录
git clone --bare [旧仓库地址]
  • 推送克隆的仓库
git push --mirror [新仓库地址]
# 配合上面的 clone --bare 可以实现库的迁移
  • 其他

忽略https校验

git config --global http.sslVerify false

解决GIT提交,文件名太长问题(filename too long)

git config --system core.longpaths true

暂时忽略文件

git update-index --assume-unchanged  '文件路径'
git update-index --no-assume-unchanged '文件路径'

导出指定开发者提交的记录

git log --author="John Doe" --since="2023-09-01" --until="2023-09-30" --pretty=format:"%h - %s (%ad)" --date=short > john_doe_september_commits.txt

子模块初始化

git submodule update --init --recursive
# 子模块初始化并拉取最新代码
git submodule update --recursive --remote

git 加速访问

  • 访问 https://sites.ipaddress.com/github.com/
  • 往下拉
    在这里插入图片描述
  • 更新源
 git remote prune origin

执行 git remote prune origin 将检查你的本地仓库与远程仓库的状态,并移除本地仓库中不存在于远程仓库的分支的引用。这样可以保持你的本地仓库与远程仓库同步。

否则有如下报错:

error: cannot lock ref 'refs/remotes/origin/dev':

修改host文件

C:\Windows\System32\drivers\etc\hosts

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值