0

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.

Daniel
  • 406
  • 1
  • 4
  • 14
  • Could you elaborate on what you mean by "pushing only the changes you made"? Please give an example of your workflow. – Patrick B. Mar 05 '15 at 13:24
  • I think that OP doesn't want to add files manually but let Git decide which files should be added to the next commit. This is not a correct use of Git though. – Arkadiusz Drabczyk Mar 05 '15 at 13:27
  • @PatrickB. Perhaps it's better to say the "pushing the changed files". – Daniel Mar 05 '15 at 13:29
  • I too understood OP wants to commit only the changed files and not the unaltered ones. Like @ArkadiuszDrabczyk said, it's not how Git is intended to use. OP may look for a kind of version-synchronization software that would allow to sync files edited since last sync. – DeDee Mar 05 '15 at 13:29
  • 3
    `git add -A` to add the current state of the working directory to the index. Afterwards, all further changes will be visible, for example by `git diff`. – poke Mar 05 '15 at 13:30
  • 1
    @poke "_visible_". OP said _don't want to commit and push all the project afterwards, but only the modified files_. – DeDee Mar 05 '15 at 13:31
  • @DeDee “Modified files” is not really clear (all files, including those on the index are modified). And you can simply not commit and push things by not committing and pushing them. (Also, this is a comment, not an answer) – poke Mar 05 '15 at 13:36
  • @DeDee By "modified files" I mean files that were different in the original state of the project, e.g. files that **I** modified. I believe the answer of Patrick B. follows your approach, does it? – Daniel Mar 05 '15 at 13:47
  • @kender6 I believe it does follow my approach. Does his answer work for you? I'm curious. – DeDee Mar 05 '15 at 15:00

1 Answers1

3

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.

Patrick B.
  • 11,773
  • 8
  • 58
  • 101
  • It's working. The only minor problem I see is that this approach doesn't include new files created after the git add. – Daniel Mar 13 '15 at 14:17
  • Yeah, well, you workflow is a little bit strange, to be honest and the tools you requested to use are more or less adapted for it. To have a better user-experience but still using git maybe you'll need to adapt your flow. – Patrick B. Mar 13 '15 at 16:03
  • I could also use another tool. I suggested git because I though there could be a good way to do it with it. Do you have any suggestions? – Daniel Mar 17 '15 at 12:42