It is necessary to add to the existing project some differences from the repository on GitNub.
I run the git diff origin/master master and get an insanely long tape of differences.
Question: how to add changes only to some files?

  • Add a specific file through -- - Nofate
  • @Nofate understood - thanks! Can I add changes to files only from certain directories? - buyboy
  • 3
    If only some changes are needed, then you need to either suffer with the merge, or make the old fashioned way. First do git diff and save yourself a conclusion. Then open in the editor and "correct". And then use the git patch to apply the resulting diff. - KoVadim
  • one
    not necessary. Do not invent. And better read the basic things in the gita. And yes, forget everything you knew about svn / cvs - KoVadim

1 answer 1

For the diff command, you can specify "scope": after all options and parameters, list an arbitrary number of files / directories.

In order to “facilitate” the work of the git program and clearly separate the options / parameters from the file / directory list, it is better to insert a special option in front of the list.

eg:

 $ git diff опции-и-параметры -- файл1 каталог1 каталог2/файл2 ...