
笔记•2025年4月3日•10 min
git 笔记
1. 当远程仓库有代码时,将本地仓库代码同步到远程仓库
- 本地仓库执行初始化
git init
- 本地仓库添加远程仓库地址
sh
git remote add origin URL_ADDRESS
- 让本地代码与远程仓库同步
sh
git fetch origin
git stash
git reset --hard origin/master
git stash pop
# 手动解决冲突
- 提交本地代码到远程仓库
sh
git add .
git commit -m "commit message"
git push origin master