Home > Blockchain >  Git doesn't see changes in local repo and wont commit
Git doesn't see changes in local repo and wont commit

Time:08-15

I am new to git, but by now I have been using github so I want to learn to git bash.

I have set up git, cloned my github repo locally and when I list everything in the git folder, I can see all the files from github.

enter image description here

Now I wanted to test commiting and pushing to github so, in an existing file of code in the same folder, I simply added two lines of comments. When I tried to commit that, it said that everything is up to date with 'origin/master'. Master is my only branch.

How can I make git [see this change and commit it], push it to github and see the changes there? Could you also write what commands exactly should I use and in which order?

CodePudding user response:

Before you commit you have to add your changes.

To see the changed files do:

git status

Then add files by

git add <path to file>

After that you can commit

git commit -m "my commit message"

CodePudding user response:

You need to add your changes in order to git to see it.

try running

1) git status this will show any changes that you made and saved locally if you see changes then do git add, this will make git know that changes are coming in the next commit

2) git add -A once done , then do commit

3) git commit -m "your commit message"

and then pull before your push :)

  • Related