1

I've been working on kernel patches for the first time and I did 6 patches and added them to git. Now, whenever I commit all the files come up in the git commit message as follows: enter image description here

Now, I just want to send changes about one file at a time. I asked some people, they told I'd have to revert back the entire process and clone the staging repo again. Is there a way to remove the other files or at least revert back the changes to git?

I've used the following:

  • git rm --cached
  • git reset

Please tell if there's a way to do so.

unixia
  • 4,102
  • 1
  • 19
  • 23

1 Answers1

0

A git reset should be enough to unstage everything (if you haven't committed already), as opposed to rm --cached (which works only if the file wasn't tracked before).

From there, git add <onefile>, and the git commit will show you, in the "Changes to be committed" section, only that file.

Note that the other files will still be visible: they are displayed in comment section named "changes not staged for commit", and will not be part of the final commit message. You can ignore them: they are only listed to remind you of what remains to be added and committed.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi VonC! What I don't get is that the changes not staged for commit that are being shown here will also be sent once I try to send the patch if I have just one commit? – unixia Sep 29 '15 at 10:45
  • @timidgeek I have edited my answer to address your comment. – VonC Sep 29 '15 at 10:48