Now I have removed 5 of those files and I want to amend these changes to the last commit.I havent pushed the commit..Am using gerrit. However when I do git status it shows me Changes not staged for commit->the 5 files which are deleted and untracked files ->which are irrelevant. I want to commit only the deletion of the 5 files and I want to ammend this to the last commit. How do i do this. When I do a git commit --amend and change the message.. The file that opens up shows me the list of untracked files as well.(as a comment ofcourse).I am scared these irrelevant untracked files will get added too. What do I do in this case? Kindly suggest. Thanks!
I am scared these irrelevant untracked files will get added too!
Untracked files are not part of the next commit.
When we run git status
, it tells us what files Git has staged for the next commit. git status
gives the following categories:
When we run git commit
, we see those same categories in the commit message editor. Rest assured: the commit will contain only those files that are in the changes to be committed category; it will not contain any changes not staged for commit nor any untracked files.