git只更新未修改的内容

1. 克隆旧仓库

git clone git@github.com:pongfcnkl/alist11.git
cd alist11

2. 添加新仓库作为远程仓库

git remote add new_repo https://github.com/AlistGo/alist

3. 获取新仓库的更新

git fetch new_repo

4. 创建一个新分支来合并更新

git checkout -b update_branch

5. 合并新仓库的更新,使用 —no-commit 选项避免自动提交

git merge —no-commit —no-ff new_repo/main

6. 撤销本地修改过的文件的更改

git checkout HEAD — .

7. 提交更新

git commit -m “更新未修改的文件”

8. 切换回主分支并合并更新

git checkout main
git merge update_branch

9. 推送更新到远程仓库

git push origin main

10. 删除临时分支

git branch -d update_branch