git push提示Everything up-to-date

一、问题描述

本地代码已修改,使用git commit和push时没有报错,提示everything up-to-date,但是查看仓库代码时发现并不是最新版本的代码

二、可能原因

修改的代码所属文件没有添加到git中,所以git commit和push不会把这些文件给算上

使用Terminal输入git commit时会出现类似这样的提示

 三、解决办法

1.使用git branch查看自己目前所在分支

由于我要提交到的分支是master,所以接着需要输入下一个命令;

2.使用git checkout切换分支

 

3.使用git add将文件(前面git commit提示的文件)添加到git 

4.使用git commit -m “注释”提交代码,其中注释是自己自定义的内容

 5.最后使用git push,仓库的代码就更新啦!

  

猜你喜欢

转载自blog.csdn.net/qq_37766298/article/details/130059020