git push in the specified repository



  • I connected two repositories.

    git remote add origin https://github.com/мой_аккаунт/репозиторий_1.git -> здесь много файлов
    git remote add index https://github.com/мой_аккаунт/репозиторий_2.git -> тут пусто
    

    After that, I made changes and decided to put them on the first repository:

    git add index.php
    git commit -m "Comit"
    git push origin master
    

    All right. Then I want the same emotion on the second repository:

    git push index master
    

    and all the files, not just the index.php., were stored in an empty repository. Why?



  • As Mira writes correctly, Git can index (and therefore keep separate files and even rows in the comemite) (for binarys, not possible). But after that, Git operates only with the comedians. You can't put on a remote repository part of the commite, just a whole thing.

    Each comedian does not contain a single file, it contains a " picture " of the entire project area. I mean, when you made a commit with index.php, it actually contains:

    • New index.php
    • Everything that was in the previous (parent) comme.

    The parent therefore contains changes that are retained in it plus all of its ancestors. And so on until the first committ in the history of the project. That's why all the files are stored every time.

    Details: https://ru.stackoverflow.com/q/126895/181472

    If you need only one file, you might think about implementation, but first you need a clear set of tasks that you're trying to accomplish.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2