Na Koriah
Na Koriah

Reputation: 75

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 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

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`

enter image description here enter image description here

is there any other way than move or remove ? what should I do?

Upvotes: 0

Views: 1802

Answers (2)

Ram
Ram

Reputation: 999

If you had committed your previously modified files and don't want to push newly modified files. Then you need to use git stash. After git stash you can push your commits.

For more detail you can read https://git-scm.com/docs/git-stash

Upvotes: 0

NightSicarius
NightSicarius

Reputation: 111

Running git add on a file that has not been modified does nothing. 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. If you looked at the bottom of your screenshot after the modified file listing, you'd see the text 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.

You can also type git status to see the full list of staged and unstaged changes in your local repository.

Upvotes: 1

Related Questions