Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ This `OnlineNote` is a notebook mainly record the knowledge, problem and solutio
- Computational Chemistry
- Others

Copyright © 2022-2023 `Hui Zhou` All rights reserved.
Copyright © 2022-2025 `Hui Zhou` All rights reserved.
50 changes: 50 additions & 0 deletions docs/source/development/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,32 @@ git push origin --tags
git fetch origin --tags
```

### 冲突相关

- 对于冲突的文件,使用合并进来的分支(如 `main`)覆盖当前分支(如`test`)

1. 确保你正处于合并冲突的状态中,并且当前分支是 test。
2. 对于每一个冲突文件,使用 --theirs 选项来检出 main 的版本。
:::{note}

- 在合并操作中,--theirs 代表要合并进来的分支(即 dev/matmaster)的版本。
- --ours 代表当前所在的分支(即 test)的版本。

:::

```bash
git checkout --theirs -- path/to/conflicted_file1.js
git checkout --theirs -- path/to/conflicted_file2.css
git checkout --theirs -- path/to/conflicted_file3.html
```

3. 提交版本

```bash
git add .
git commit
```

### 历史相关

- 比较差异
Expand Down Expand Up @@ -488,6 +514,30 @@ git filter-repo --path foo.zip --invert-paths

该命令表示将 `foo.zip` 从 git 历史中移除。

## 使用 opencommit 自动生成 commit

1. 使用 npm 安装 [opencommit](https://github.com/di-sukharev/opencommit):

```bash
nvm use 18
npm install -g opencommit
```

2. 配置 OPENAI

```bash
oco config set OCO_API_URL=https://xxxx.openai.azure.com
oco config set OCO_AI_PROVIDER='azure' OCO_MODEL='gpt-4o'
oco config set OCO_API_KEY=xxx
```

3. 使用 oco 命令生成 commit

```bash
git add .
oco
```

## 更多参考资源

[1. 常用 Git 命令总结](https://zhuanlan.zhihu.com/p/384819351)
Expand Down
Loading