Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
how_to [2022/08/04 11:52] – [Add only modified changes and ignore untracked files using git?] javadhow_to [2022/08/04 16:53] – [Add only modified changes and ignore untracked files using git.] admin
Line 113: Line 113:
  
 ===== Add only modified changes and ignore untracked files using git. ===== ===== Add only modified changes and ignore untracked files using git. =====
 +
 +Using newer version of `git` (e.g., >=2.32.1),
  
 <code> <code>
-git ls-files --modified | xargs git add; git commit -'minor changes'; git push+git commit -am 'minor changes'; git push
 </code> </code>
  
-The [[https://stackoverflow.com/questions/7124726/git-add-only-modified-changes-and-ignore-untracked-files|above]] should work if there is no conflict. If there is a conflict at push time, first pull. Now, you need to look for ">>>" in the codeand manually fix the conflictThenpush again. +⚠️ <font inherit/inherit;;#e74c3c;;inherit>Caution</font>: With older versions the -a option will add all files in the directorywhich is usually NOT what you wantInsteaduse following command, which would have the same effect as above:
- +
-PS: +
- +
-by the new version of `git` the following would have the same effect as above:+
  
 <code> <code>
-git commit -am 'minor changes'; git push+git ls-files --modified | xargs git add; git commit -'minor changes'; git push
 </code> </code>
 +
 +The [[https://stackoverflow.com/questions/7124726/git-add-only-modified-changes-and-ignore-untracked-files|above]] should work if there is no conflict. If there is a conflict at push time, first pull. Now, you need to look for ">>>" in the code, and manually fix the conflict. Then, push again.
  
 ---- ----