Git常用方法
本文最后更新于 2025年8月25日 晚上
合并问题
| 配置命令 | 对应策略 | 等价命令 |
|---|---|---|
git config pull.rebase false |
普通合并 | git pull --merge |
git config pull.rebase true |
变基合并 | git pull --rebase |
git config pull.ff only |
仅允许快进 | git pull --ff-only |
OpenSSL SSL_read: Connection was reset, errno 10054
1 | |
更新本地代码
https://www.cnblogs.com/delav/p/11118555.html
连接远程仓库
一、本地已创建仓库, 然后与远程仓库关联
初始化 Git 仓库
git init
添加文件到暂存区
git add .
提交改变到缓存
git commit -m 'description'
分支管理
git branch -M main
本地 git 仓库关联 GitHub 仓库
git remote add origin xxx
提交到远程仓库
git push -u origin main
二、不用关联远程仓库, 直接从远程仓库克隆到本地
从 GitHub 上克隆项目到本地
git clone xxx
添加文件到暂存区
git add .
提交改变到缓存
git commit -m 'description'
提交到远程仓库
git push -u origin main
Git常用方法
https://xuekeven.github.io/2021/08/07/Git常用方法/