我使用git status命令得到以下结果:
git status
On branch master
Your branch and 'origin/master' have diverged,
and have 3 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: application/models/Usuario_model.php
modified: application/views/Autor/listar.php
modified: application/views/Libro/modificar.php
modified: application/views/Libro/perfil.php
modified: application/views/ListaLibros/listar.php
modified: application/views/Valoracion/crearOk.php
no changes added to commit (use "git add" and/or "git commit -a")
git add <file>
命令无效
git pull
命令输出如下:
git pull
: Your local changes to the following files would be overwritten by merge:
application/models/Usuario_model.php
application/views/Autor/listar.php
application/views/Libro/perfil.php
application/views/ListaLibros/listar.php
application/views/Valoracion/crearOk.php
commit your changes or stash them before you merge.
Aborting
我无法推送,因为“当前分支的末端落后于其远程对应分支”。
因此,在拉取之前我不能推送,也不能在提交之前执行拉取,并且由于我无法暂存更改,所以无法提交。
发生了什么情况,我该如何解决它?
git commit -m "Your Message"
命令之前,您可以尝试使用git add *
命令。 - Vinit Divekargit add application
然后运行git status
会发生什么?这两个命令的输出是什么? - Code-Apprenticegit add application
后没有任何反应,而且git status
显示的内容和之前一样。 - Juan Antonio Rodríguez Gabriel.gitignore
文件,看看是否有任何规则匹配这些文件。确保你在正确的目录下。最后,如果所有其他方法都失败了,你可以使用我回答中描述的git stash
命令来拉取更改。不幸的是,你仍然需要解决提交更改的问题。 - Code-Apprentice