-1

As given below - I have committed the file from my workspace using -a option in the branch RB-1.1 but it seems to be still in untracked status.

Please suggest -

kumar113@sony MINGW64 ~/Documents/Hera_GitLab/testproject-for-hera (RB-1.1)
$ git commit -a -m "added pyhton file"
On branch RB-1.1
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        apqr_read.py

nothing added to commit but untracked files present (use "git add" to track)

kumar113@sony MINGW64 ~/Documents/Hera_GitLab/testproject-for-hera (RB-1.1)
$ git status
On branch RB-1.1
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        apqr_read.py

nothing added to commit but untracked files present (use "git add" to track)
Raghavendra Gupta
  • 355
  • 1
  • 2
  • 15
  • 1
    This is one (of many) reasons I recommend *avoiding* `git commit -a`. It's occasionally handy as a short-cut, but it is better to run `git status` and manually `git add` specific files or use `git add -u` to add all updated files (and then run `git status` again to check!). – torek Sep 02 '22 at 08:45

1 Answers1

3

You Can't Commit Untrack files directly with git commit -a -m "added pyhton file". for that you must use git add <file_name> and then you need to commit.

Monish Khatri
  • 820
  • 1
  • 7
  • 24
  • Yes, got it now. Also, this answers my query too. https://stackoverflow.com/a/8470758/9556314 – Raghavendra Gupta Sep 02 '22 at 05:04
  • 1
    @RaghavendraGupta: also mentioned in the question you linked : use `git add --all` (or `git add -A` with uppercase `A`) to add all files – LeGEC Sep 02 '22 at 05:06