git常用命令实践

创建两个本地代码仓库repo4,repo5然后开始演示常用的命令实践。主要采用https模式,SSH模式请参考菜鸟教程

在repo4的文件目录下创建一个hello.txt

git init:使用当前目录作为Git仓库,我们只需使它初始化

git add Hello.txt:将hello.txt添加到本地仓库

git commit -m 'repo4':将hello.txt添加到版本浏览器中

使用gitee上的仓库做实验(Https)

git remote -v 显示所有远程仓库

git remote add [shortname] [url] 添加远程版本库

# 提交到 Github
$ git remote add origin git@github.com:tianqixin/runoob-git-test.git
$ git push -u origin master
git remote rm name  # 删除远程仓库
git remote rename old_name new_name  # 修改仓库名

  

如果使用git push -u origin master提交失败可以使用git push -f origin master进行强制提交

一纸高中万里风,寒窗读破华堂空。 莫道长安花看尽,由来枝叶几相同?
原文地址:https://www.cnblogs.com/byczyz/p/14394226.html