02/12/2014 - GIT
Assume that you have a lot of tracked and untracked files in your working directory and you only want to index tracked files in one go so that untracked files would be ignored in next commit. This is when git add -u
command comes in handy. For more information, click git add link.
inanzzz@inanzzz:~/project$ git status
On branch develop
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: services.yml
modified: index.html.twig
Untracked files:
(use "git add <file>..." to include in what will be committed)
new_file.txt
no changes added to commit (use "git add" and/or "git commit -a")
inanzzz@inanzzz:~/project$ git add -u
inanzzz@inanzzz:~/project$ git status
On branch develop
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: services.yml
modified: index.html.twig
Untracked files:
(use "git add <file>..." to include in what will be committed)
new_file.txt
inanzzz@inanzzz:~/project$ git commit -m 'Just commit indexed/tracked'
[develop 31796e2] Just commit indexed/tracked
2 files changed, 1 insertion(+), 4 deletions(-)
delete mode 100644 services.yml
inanzzz@inanzzz:~/project$ git status
On branch develop
Untracked files:
(use "git add <file>..." to include in what will be committed)
new_file.txt
nothing added to commit but untracked files present (use "git add" to track)