Git问题总结

一、提交问题

a、命令:

$ git commit -m "update the blog"

b、现象:

On branch master

Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:

modified:  .idea/workspace.xml

modified:  blogs.html

no changes added to commit

c、方案:

        只有暂存区域的文件(即:文件状态为“Changes to be committed”)才会被提交。正如提示:

Changes not staged for commit:

modified:  .idea/workspace.xml

modified:   blogs.html

有两个文件被修改,但是没有被提交,通过“git add fileName”命令将已修改文件更新到暂存区域中,如果想撤销修改,可以使用“git checkout -- fileName”命令

此处可以使用命令:

$ git add blogs.html

以及

$ git add \.idea

将文件添加到暂存区,再通过命令:

$ git commit -m "update the blog page"

以及

$ git push origin master

提交到远程库。

二、提交没有add,commit问题

error:src refspec master does not match any

本地版本库为空, 空目录不能提交 (只进行了init, 没有add和commit).

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容