我刚刚开始学习 Windows 上的 GitHub CLI 工具。认为我是新手
我有一个如下所示的用例:
在深入探讨之前,让我先总结一下:
我的用例是:克隆一个开源项目(它更新
定期),即创建它的本地副本并进行修改(包括
重命名文件和文件夹),将更改推送到我的私人存储库
但同时我需要来自开源的定期更新
项目以重命名的格式反映。我是否必须重命名文件&
项目每次发布更新时的文件夹并将其推送到我的
私人回购?
假设项目 A 是一个定期更新其文件的开源项目。项目 B 是我在 GitHub 上的私人存储库。将我的项目 C(本地存储库)链接到 Origin(项目 B)和上游(项目 A)的所有初始步骤都已通过 .git 文件夹内的 cli 和配置文件完成。
在我的电脑上,我的本地副本Project C已经使用命令获取
git克隆“https:..../project-B.git”
现在我的目的如下:
1.对我计算机上的本地副本项目 C 中的代码本身进行大量自定义,并将这些更改推送到我的私人副本:项目 B。这包括但不限于重命名项目文件夹和文件。
2.从项目 A 获取定期更新,并在私人仓库项目 B 中更新同样的内容。
简而言之,我的私人回购项目 B 应该包含我的更改以及上游端发生的常规更改:项目 A
实现这一目标的最佳方法是什么?我知道将本地副本推送到 Private Repo B 的步骤如下:
Step 1 : git status -->to check for the changes in local copy.
Step 2 : git add --all
Step 3 : git commit -m 'message reflecting the nature of change'
Step 4 : git push -u origin master
where origin is my Private repo B and master is the branch that contains all the files.
我还知道可以使用以下方法拉取上游文件:
git pull upstream master --> to pull in the latest changes from project A onto project B.
因此我的问题是:
1.我到底应该何时使用 git pull 或 git rebase 与 find renames :在推送提交的更改之前或之后。我有限的理解是 git rebase 是在 origin 中查找重命名的文件(在我的用例中)并进行更改?
Or
2.我需要一种完全不同的方法吗?
Or
3. 针对上述问题的方法稍有改动?
EDIT:
我已经使用命令 git push -u origin master 成功推送了本地更改(项目 C-> 项目 B(git 上的私有存储库))。
只是,我需要知道如何从存储库项目 A(定期更新的开源)中提取更改并更新已重命名的当前本地副本(文件夹、文件其他所有内容)以及添加的其他新代码行。最终,我需要从项目 C(本地副本)---> 项目 B(私有存储库)推送这些更新的更改,并使我的私有存储库具有最新提交的 UpToDate。
编辑:将公共存储库 docker-jitsi-meet 作为存储库,我需要定期更新,并在我的私人存储库中进行修改和重命名。
我做了以下事情:
1.我将公共 jitsi-meet 存储库克隆到我的本地计算机上。
2.git克隆--裸github.com/jitsi/docker-jitsi-meet.git。
3.cd 到我的本地副本并 git push github.com/user/project.git (私人仓库)。
4 删除裸副本并立即克隆存储库 git clone github.com/user/project.git
5.将公共上游存储库添加为远程仓库:git remote add upper github.com/jitsi/docker-jitsi-meet.git。
6 git fetch --all 显示了我需要引入的来自上游的许多更改。
- I use
git 合并上游/master
并显示以下跟踪:
$ git merge upstream/master
Auto-merging CHANGELOG.md
Auto-merging docker-compose.yml
CONFLICT (content): Merge conflict in docker-compose.yml
Auto-merging focus/rootfs/defaults/jicofo.conf
CONFLICT (content): Merge conflict in focus/rootfs/defaults/jicofo.conf
CONFLICT (modify/delete): jibri/Dockerfile deleted in HEAD and modified in upstream/master. Version upstream/master of jibri/Dockerfile left in tree.
CONFLICT (modify/delete): prosody/rootfs/etc/cont-init.d/10-config deleted in HEAD and modified in upstream/master. Version upstream/master of prosody/rootfs/etc/cont-init.d/10-config left in tree.
Auto-merging web/rootfs/defaults/system-config.js
CONFLICT (content): Merge conflict in web/rootfs/defaults/system-config.js
Auto-merging xmpp/rootfs/defaults/conf.d/jitsi-meet.cfg.lua
CONFLICT (content): Merge conflict in xmpp/rootfs/defaults/conf.d/jitsi-meet.cfg.lua
Automatic merge failed; fix conflicts and then commit the result.
- I did
git $ git mergeupstream/master -X --strategy-option =“find-renames = 20”
并得到以下内容:
error: Merging is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.