想切换成 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”
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
-b
clone 的时候可以指定分支,例如:
git clone -b 4.27.2-release --depth=1 git@github.com:EpicGames/UnrealEngine.git
功能记录
cherry pick
如果只想要某个commit,不需要直接把branch全部合入过来,可以用 cherry pick: https://www.ruanyifeng.com/blog/2020/04/git-cherry-pick.html
reset
想把commit的东西给回退到本地,更改后或者pull后重新commit上去,可以用 git reset
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/troubleshooting-ssh/error-permission-denied-publickey
GitHub
查看 history
https://blog.csdn.net/weixin_30615767/article/details/100091029
设置默认分支
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