How do I commit a specific file in git?

Asked

Viewed 1,662 times

-3

Note the image below:

inserir a descrição da imagem aqui

I want commit only the second file.

How do I? What’s the command in git?

  • 5

    Something like git add <file>?

  • 1

    For future references, the answer is explicit in the question image itself. Immediately above the list of files in red there is "Changes not staged for commit", followed by two possible commands. One to add the desired files, another to discard changes to a file.

  • @Andersoncarloswoss Inclusive I think the question should be closed as "typo" (ok, no typing, but.

  • I made an issue that I thought made the question more useful for future readers. Although "the error is self-explanatory", as most of the time. If you find it improper, you can revert to revision

1 answer

9


First add the specified file of the second line in the staging area, in case it is the context.xml:

git add proj/WebContent/META-INF/context.xml

After adding it, run the commit

git commit -m "Mensagem"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.