0

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?

Na Koriah
  • 75
  • 2
  • 3
  • 12

2 Answers2

1

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.

  • but the file I want to push is a new file – Na Koriah Oct 26 '18 at 03:38
  • If it is a new file that has not previously been committed and is not covered by `.gitignore`, then it should show up as an unstaged change. Can you confirm that it has not previously been committed? – NightSicarius Oct 26 '18 at 03:46
  • I have previously added and committed the file – Na Koriah Oct 26 '18 at 03:49
  • Your new screenshot is indicating that you've got locally modified files that would be overwritten if you did the `git pull`. As per the instructions, you should either revert those changes (using `git clean` for untracked files and `git reset --hard` for modified files) or you should stage and commit those modified files before pulling. – NightSicarius Oct 26 '18 at 04:00
0

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

Ram
  • 991
  • 7
  • 8
  • Using `git stash` but when I pull, there something error. see my question, screen shot – Na Koriah Oct 26 '18 at 03:50
  • You can use git clean to remove untracked files from working directories. For more details read https://stackoverflow.com/questions/61212/how-to-remove-local-untracked-files-from-the-current-git-working-tree – Ram Oct 26 '18 at 03:54