Git 记录大全

想切换成 ssh 协议来 push

https://stackoverflow.com/questions/14762034/push-to-github-without-a-password-using-ssh-key

示例:
git add xxx
git commit -m "xxx"
git remote set-url origin git@github.com:hebohang/glfw.git
git push

错误记录

git submodule: "already exists in the index"

https://stackoverflow.com/questions/12898278/issue-with-adding-common-code-as-git-submodule-already-exists-in-the-index

OpenSSL SSL_read:

git clone 的时候发生的错误。

这是服务器的SSL证书没有经过第三方机构的签署,所以报错。

解决方法:git config --global http.sslVerify "false"

https://www.cnblogs.com/jfen625/p/12995408.html

文件夹大小写问题

貌似 Windows 默认不分大小写,但是我们可以在项目的:.git->config 中将 ignorecase 手动改为 false

更新版本

Windows:git bash
git update-git-for-windows

一些参数

比较差异

git difftool --dir-diff

--depth=1

建议不想给项目做贡献或者看历史啥的就用这个就好了。

--recursive

在有子目录的时候需要用:
git clone --recursive

功能记录

cherry pick

如果只想要某个commit,不需要直接把branch全部合入过来,可以用 cherry pick:
https://www.ruanyifeng.com/blog/2020/04/git-cherry-pick.html

reset

想把commit的东西给回退到本地,更改后或者pull后重新commit上去,可以用 git reset
image
https://juejin.cn/post/6844904185129861128

submodule

更新

git submodule update --init --recursive

Ubuntu Git

https://blog.csdn.net/Chenftli/article/details/81141010

关于 git@github.com: Permission denied (publickey).

https://docs.github.com/cn/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
https://docs.github.com/cn/authentication/troubleshooting-ssh/error-permission-denied-publickey

GitHub

查看 history

image

https://blog.csdn.net/weixin_30615767/article/details/100091029

设置默认分支

image

fork的项目升级

https://zhuanlan.zhihu.com/p/291845721

指明我们需要同步的仓库:
git remote add upstream https://github.com/OriginalRepo/OriginalProject.git

拉取更新的 branches 和 commits:
git fetch upstream

合并:
git merge upstream/master

posted @   hebh  阅读(43)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示