6

I am having trouble adding untracked files or modified files on git. This is the message I am getting:

On branch homework110515 Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) (commit or discard the untracked or modified content in submodules)

modified:   MarcoPortfolio (untracked content)
modified:   session2.2 (modified content)
Marcode777
  • 187
  • 1
  • 3
  • 10
  • 3
    Possible duplicate of [Adding Only Untracked Files](http://stackoverflow.com/questions/7446640/adding-only-untracked-files) – Greg Nov 06 '15 at 04:02

1 Answers1

12

You have pending changes in your workspace. To stage them for a commit you need to add them. Basically exactly what it says: "Changes not staged for commit". To stage changes you need to add them with the add command:

git add [file]

Typically I just add all the files in the working directory with:

git add .

At this point you can commit your changes with git commit -m "[message]"

Swoogan
  • 5,298
  • 5
  • 35
  • 47
  • @Marcode777 Can you do a `git status` and edit your question with the output? – Swoogan Nov 07 '15 at 00:46
  • 1
    Doesn't totally answer the question... how to add only untracked files, not including modified files -> https://stackoverflow.com/a/3801554/1388017 – dezman Jun 13 '22 at 20:09
  • @dezman I disagree. The question states "adding untracked files or modified files." – Swoogan Jun 14 '22 at 17:24