简体   繁体   English

将更改从非git目录推送到非空git存储库

[英]Push changes from non-git directory to a non-empty git repository

I downloaded an existing Git Project (instead of cloning it). 我下载了一个现有的Git项目(而不是克隆它)。 I have made some changes to the code. 我对代码做了一些更改。 Now I want to push the changes to the existing repository. 现在,我想将更改推送到现有存储库。

I saw some examples ( Github guide , Stack overflow ) but they all assume that remote repository is empty. 我看到了一些示例( Github指南堆栈溢出 ),但它们都假定远程存储库为空。

In my case, the remote repository is not empty. 就我而言,远程存储库不为空。 I want to push just the additional code (diff) on top of a certain branch. 我只想将附加代码(diff)推送到某个分支的顶部。 Any ideas? 有任何想法吗?

我认为最简单的方法是克隆现有存储库,然后检出同一分支,然后将非git目录中更改的文件复制到git项目目录中,然后提交它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM