git本地仓库删除后从远程仓库更新代码

1、$ ssh-agent bash

2、$ ssh-add ~/.ssh/id_rsa_hyp 添加ssh密匙

3、$ git fetch [email protected]:xxx.git master 从远程仓库fetch项目

4、也可以git fetch [email protected]:xxx.git master:temp建立新分支temp,将代码合并到新分支temp上,在删除新分支temp

5、$ git merge FETCH_HEAD 合并项目

6、$ git status 查看状态

7、$ git add -A 增加修改后的文件

8、$ git commit -m "optimization write protection!" 提交

9、$ git remote add origin [email protected]:xxx.git 添加远程仓库

10、$ git push -u origin master 推送到远程仓库

猜你喜欢

转载自www.cnblogs.com/yeshenmeng/p/11611423.html