Home > Mobile >  Unable to commit and push files in a folder to GitHub
Unable to commit and push files in a folder to GitHub

Time:10-22

I'm trying to commit an update to GitHub through gitbash, but it doesn't seem to work. The pictures below show

Changes done in the files, but gitbash says it's up to date:

1

My repository:

2

CodePudding user response:

You might want to push what you have added/committed locally.

So if you have changes in progress, as reported by git status, make sure to add/commit first, before pushing.

Check also, still with git status, that you are on a branch (and not a enter image description here

The red color in your screenshot indicates non-staged files.

To commit files, you need to add/stage them first. Use git add filepath to stage single files. You can also do git add . to stage them all at once.

When you run git status again, files appear in green in your terminal.

Learn more: https://github.com/git-guides/git-add

Once staged, you can use git commit or git commit -m "message" as you have already done. Then, git push will work and update the remote.

  • Related