[英]merging code outside of git into an existing git project
I have an existing git project, let's call it BobCrane. 我有一个现有的git项目,我们称其为BobCrane。 This needed to completely re-work this project's extensive directory structure.
这需要完全重新设计该项目的广泛目录结构。
I created the needed directory structure on the filesystem, outside of any git project. 我在任何git项目之外的文件系统上创建了所需的目录结构。 I then manually copied each file from the cloned BobCrane repo into this new directory structure.
然后,我从克隆的BobCrane存储库中手动将每个文件复制到此新目录结构中。 So the new directories are filled with old files;
因此,新目录中充满了旧文件; there are only one or two new ones that didn't exist before.
只有一两个新的不存在。
How can I add/commit/push this new structure to the existing git repo? 如何将这个新结构添加/提交/推送到现有的git repo? Is this related to "rebasing"?
这和“变基”有关吗?
git init
git add -A git commit -m "commit message"
git remote add origin your_existing_repository@url
\n git pull origin remote_branch_namegit pull origin remote_branch_name\n
\n git add -Agit添加-A\n git merge --continue
git merge-继续\n
git rebase origin/remote_branch_name
5.1. 5.1。 Rebase onto remote branch
重新定位到远程分支
git add -A git rebase --continue
5.2. 5.2。 Resolve conflicts if any and execute
解决冲突(如果有)并执行
\n git add -Agit添加-A\n git rebase --continue
git rebase-继续\n
\n git push -u origin remote_branch_namegit push -u原始remote_branch_name\n
Rebase is preferred way because it will produce cleaner commits history Rebase是首选方法,因为它将产生更干净的提交历史记录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.