bluethundr
bluethundr

Reputation: 1325

git is ignoring the 'git add' command'

I'm on windows 10 and I'm trying to add some changes to a file to a branch.

I'm going:

git add aws_ec2_list_instances.py

And when I got git status nothing is added:

$ git status
On branch python
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   __pycache__/web_scraper.cpython-37.pyc
        modified:   __pycache__/web_scraper.cpython-38.pyc
        modified:   aws_s3_list_buckets.py
        modified:   web_scraper.py

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        ../../output_files/
        aws_ec2_list_instances_old.py
        ../../source_files/

no changes added to commit (use "git add" and/or "git commit -a")

Doing a git add --all or git add --force gives the same result. Nothing is added!

If I list the directory aws_ec2_list_instances.py is there:

git ls-files
__pycache__/web_scraper.cpython-37.pyc
__pycache__/web_scraper.cpython-38.pyc
aws_ec2_list_instances.py
aws_s3_list_buckets.py
web_scraper.py

I'm on this version of git for windows: git version 2.24.1.windows.2

How can I solve this?

Upvotes: 2

Views: 209

Answers (2)

VonC
VonC

Reputation: 1323773

The file has changed. I tried putting in print('Test')` in the file and copied it several times and saved it.

Then you have tried to modified a different aws_ec2_list_instances.py, in a different path.
Double-check your editor (VSCode?) and see if:

  • the path is correct
  • the case is correct
  • it is able to actually save the file (which might refuse new modification if its handle is used by another Windows process)

Upvotes: 1

laserany
laserany

Reputation: 1451

Your file name doesn't seem to match the file names that needed to be added. If you want to add all your changes then just use git add . command

I would recommend installing github desktop. It is easy and more convenient to use than using the command line.

Upvotes: 0

Related Questions