简体   繁体   English

无法提交并推入gitlab

[英]cannot commit and push in gitlab

I want to push some file using git, but when I add some file which want to push and when I commit that, show this : 我想使用git推送一些文件,但是当我添加一些要推送的文件并提交时,显示如下:

git commit -m "Form-View-Controller-Models-Seeder-Route-Team"

On branch dev

Changes not staged for commit:

    `modified:   app/Http/Controllers/Auth/RegisterController.php`
    `modified:   app/Http/Controllers/Auth/ResetPasswordController.php`

even though it's not my file who doesn't want to push. 即使不是我的文件也不想推送。 when I try git status show this : 当我尝试git status显示以下内容:

git status

On branch dev

Changes not staged for commit:

(use "git add/rm <file>..." to update what will be committed)

(use "git checkout -- <file>..." to discard changes in working directory)

    `modified:   app/Http/Controllers/Auth/RegisterController.php`
    `modified:   app/Http/Controllers/Auth/ResetPasswordController.php`
    `modified:   app/Http/Controllers/HomeController.php`

在此处输入图片说明 在此处输入图片说明

is there any other way than move or remove ? 除了移动或删除,还有其他方法吗? what should I do? 我该怎么办?

Running git add on a file that has not been modified does nothing. 在未修改的文件上运行git add不会执行任何操作。 According to the screenshot you included, you're trying to stage a bunch of files that have not changed, so there's nothing to commit when you go and run git commit . 根据包含的屏幕截图,您正在尝试git commit一堆未更改的文件,因此在运行git commit时没有要git commit If you looked at the bottom of your screenshot after the modified file listing, you'd see the text no changes added to commit . 如果您在修改后的文件列表之后查看屏幕快照的底部,则会看到文本no changes added to commit

If you've previously committed those changes and you're attempting to push these to a remote repository, you should use git push with the appropriate arguments. 如果您以前已经提交了这些更改,并且尝试将其推送到远程存储库,则应将git push与适当的参数一起使用。

You can also type git status to see the full list of staged and unstaged changes in your local repository. 您也可以输入git status来查看本地存储库中已分阶段和未分阶段更改的完整列表。

If you had committed your previously modified files and don't want to push newly modified files. 如果您提交了以前修改的文件,并且不想推送新修改的文​​件。 Then you need to use git stash . 然后,您需要使用git stash After git stash you can push your commits. git stash您可以推送您的提交。

For more detail you can read https://git-scm.com/docs/git-stash 有关更多详细信息,您可以阅读https://git-scm.com/docs/git-stash

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM