git 笔记
笔记2025年4月3日10 min

git 笔记

1. 当远程仓库有代码时,将本地仓库代码同步到远程仓库

  1. 本地仓库执行初始化
git init
  1. 本地仓库添加远程仓库地址
sh
git remote add origin URL_ADDRESS
  1. 让本地代码与远程仓库同步
sh
git fetch origin
git stash
git reset --hard origin/master
git stash pop
# 手动解决冲突
  1. 提交本地代码到远程仓库
sh
git add .
git commit -m "commit message"
git push origin master