Files
mengyanote/mengyanote-backend/data/mengyanote/Git/Linux下使用git探索.md
2026-03-18 22:03:40 +08:00

53 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
**修改全局代理为http1**
```
git config --global http.version HTTP/1.1
```
**相当于 git fetch + git merge会把远程最新提交合并到你当前分支。**
```
git pull
```
**这会把你的本地提交临时“挪开”,先更新远程提交,然后再把你的提交放回去,避免多余的合并记录。**
```
git pull --rebase
```
**如果只想下载最新提交但不合并**
```
git fetch
```
**树萌芽GitHub仓库提交代码通用密钥**
```
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
```
### 1. 添加所有改动
```
git add .
```
### 2. 提交,写上提交说明
```
git commit -m "更新说明"
```
### 3. 推送到远程仓库(假设分支是 main
```
git push origin main
```
**压缩成一条命令实现:**
```
git add . && git commit -m "update" && git push origin main
```
**或者设置命令别名,比如写进 ~/.bashrc 或 ~/.zshrc**
```
alias gopush='git add . && git commit -m "update" && git push origin main'
```
注意:校园网可能会屏蔽梯子,必要时开热点提交