git简单使用

git的简单使用

安装git的步骤在这里就不说了

选择提交文件夹,右键单击git bash here

  • 1.创建本地git仓库
    git init
    当前文件夹下回出现后缀名为 .git的隐藏文件

  • 2.新建文件,将本地文件添加到暂存区
    查看当前仓库文件的状态: git status

将本地文件添加到暂存区
git add .

再查看文件状态:

现在,文件是已经提交到了暂存区的状态

  • 3.将暂存区文件提交到版本库
    git commit -m "备注说明"

再查看文件状态:

文件熊暂存区消失,提交到了版本库

  • 4.将本地仓库与远程仓库连接起来
    git remote add origin "远程仓库地址"

  • 5.推送代码到远程仓库
    第一次推送时:
    git push -u origin master

以后推送时:
git push origin master

posted @ 2019-11-04 10:54  zoo-x  阅读(183)  评论(0)    收藏  举报