Git 更换设备后怎么做

Git 更换设备后怎么做

Git 更换设备后怎么做

旧仓库

1
2
3
4
5
6
7
8
9
10
11
git init 仓库名字
# 建立远程连接
git remote add origin https://github.com/user/repo.git
#获取远程更新
git fetch origin
# 把更新的内容合并到本地分支
git merge origin/master
# 加入差异的文件,就是本地修改的文件
git add .
git commit -m "Commit message"
git push origin master

新仓库

1
2
3
4
5
git init()
git remote add origin https://github.com/user/repo.git
git add .
git commit -m "Commit message"
push origin master

建议

  • 拉取时推荐
1
2
git fetch origin master
git merge origin/master
  • 不推荐
1
git pull

  GitLinux

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×