Search code examples
gitgit-pushgit-commitgit-add

Git - Adding files to the index without committing them


I am working in a project of around 50k files, of which I am only modifying a few of them. I have the project locally in my computer and I am using Gitorious to push the changes I make to it, but as for now I have to manually look for the changed files and I don't want to miss any of them.

Therefore, I would like to add all my project to the index, so after that GIT can tell me what changes I have made. The problem is that I don't want to commit and push all the project afterwards, but only the modified files. Is it possible?

Example: I modified 14 files in the project, so I would like to push these 14 files. I don't want miss any of them, so I would like GIT to tell me what files have been modified.


Solution

  • I see an approach with several steps:

    git add .  # to index all files
    [.. do you changes ..]
    git diff --name-only > list 
        # file list of modified files compared to index 
        # stored into a file called 'list'
    git reset HEAD     # to unstage all files
    git add `cat list` # to stage all files you have previously modified
    

    This works as to what I understand from your question.