git 两个不同文件夹中两个不同存储库之间的差异
git diff among two different repositories in two different folder
我想知道如何从 9.3.1-STABLE 和 TN-9.3.1-STABLE 获得 git 差异,具有以下 folder/git 结构
root@build3:/tank/home/stable-builds/FN # git branch
9.3-STABLE
* 9.3.1-STABLE
root@build3:/tank/home/stable-builds/TN # git branch
TN-9.3-STABLE
* TN-9.3.1-STABLE
master
任何答案将不胜感激。
首先我们让两个 git 存储库相互了解
转到一个存储库
cd /tank/home/stable-builds/FN
将另一个仓库添加为 "remote"
git remote add TN /tank/home/stable-builds/TN
获取另一个 repo
git fetch TN
现在,我们要求差异化
git diff 9.3.1-STABLE remotes/TN/TN-9.3.1-STABLE
如果您打算定期进行此类差异,我建议使用远程存储库
如 @BartBog 的回答所述。
如果没有,您可以在不添加远程存储库的情况下执行以下操作:
选项 1:
git diff --no-index -- /tank/home/stable-builds/FN /tank/home/stable-builds/TN
或简单地:
git diff /tank/home/stable-builds/FN /tank/home/stable-builds/TN
来自 git 手册:
git diff [options] [--no-index] [--] <path> <path>
This form is to compare the given two paths on the filesystem. You can omit the --no-index
option when running the command in a working tree controlled by Git and at least one of the paths points outside the working tree, or when running the command outside a working tree controlled by Git.
注意:它比较文件系统上的工作副本。
选项 2:
如果要将 FN 工作副本与 TN 中的 TN-9.3.1-STABLE 分支进行比较,可以执行以下操作:
如果你在/tank/home/stable-builds/FN
:
git --git-dir=../TN/.git diff TN-9.3.1-STABLE
如果你在其他地方:
git --git-dir=/tank/home/stable-builds/TN/.git --work-tree=/tank/home/stable-builds/FN diff TN-9.3.1-STABLE
来自 git 手册:
--git-dir=<path>
Set the path to the repository.
--work-tree=<path>
Set the path to the working tree.
git diff origin/9.3.1-STABLE TN-9.3.1-STABLE
这对我有用,实际上 origin/9.3.1-STABLE 和 TN-9.3.1-STABLE 是同一个仓库中的分支。
当我发布这个问题时,我认为 9.3.1-STABLE 和 TN-9.3.1-STABLE 是不同的回购协议,如果有任何混淆,我们深表歉意。
# git diff --stat origin/9.3.1-STABLE TN-9.3.1-STABLE
ChangeLog | 26 +++++-
Makefile | 12 +--
README.md | 6 +-
ReleaseNotes | 97 ++++------------------
build/README | 6 +-
build/create_redmine_changelog.py | 4 +-
build/files/install.sh | 4 +-
build/nanobsd-cfg/FREENAS.amd64 | 3 -
build/nanobsd-cfg/Files/etc/rc.conf.local | 7 +-
^^^ 将只为您提供更改的文件,以及完整路径,您可以执行类似下面的操作以清楚地了解到底发生了什么变化以及在哪里。
# git diff origin/9.3.1-STABLE:ChangeLog TN-9.3.1-STABLE:ChangeLog
diff --git a/origin/9.3.1-STABLE:ChangeLog b/TN-9.3.1-STABLE:ChangeLog
index 35e315e..656c681 100644
--- a/origin/9.3.1-STABLE:ChangeLog
+++ b/TN-9.3.1-STABLE:ChangeLog
@@ -1,2 +1,24 @@
-#11936 Bug Critical UI left pane does not populate
-#12208 Bug Critical Fix late-breaking issue with ntpd update
+o Add a vCenter plugin. This functionality allows you to install
+ the TrueNAS 1.0 vCenter plugin in to vCenter, which will then
+ allow you to create iSCSI and NFS datastores directly from vCenter.
我想知道如何从 9.3.1-STABLE 和 TN-9.3.1-STABLE 获得 git 差异,具有以下 folder/git 结构
root@build3:/tank/home/stable-builds/FN # git branch
9.3-STABLE
* 9.3.1-STABLE
root@build3:/tank/home/stable-builds/TN # git branch
TN-9.3-STABLE
* TN-9.3.1-STABLE
master
任何答案将不胜感激。
首先我们让两个 git 存储库相互了解
转到一个存储库
cd /tank/home/stable-builds/FN
将另一个仓库添加为 "remote"
git remote add TN /tank/home/stable-builds/TN
获取另一个 repo
git fetch TN
现在,我们要求差异化
git diff 9.3.1-STABLE remotes/TN/TN-9.3.1-STABLE
如果您打算定期进行此类差异,我建议使用远程存储库 如 @BartBog 的回答所述。
如果没有,您可以在不添加远程存储库的情况下执行以下操作:
选项 1:
git diff --no-index -- /tank/home/stable-builds/FN /tank/home/stable-builds/TN
或简单地:
git diff /tank/home/stable-builds/FN /tank/home/stable-builds/TN
来自 git 手册:
git diff [options] [--no-index] [--] <path> <path>
This form is to compare the given two paths on the filesystem. You can omit the
--no-index
option when running the command in a working tree controlled by Git and at least one of the paths points outside the working tree, or when running the command outside a working tree controlled by Git.
注意:它比较文件系统上的工作副本。
选项 2:
如果要将 FN 工作副本与 TN 中的 TN-9.3.1-STABLE 分支进行比较,可以执行以下操作:
如果你在
/tank/home/stable-builds/FN
:git --git-dir=../TN/.git diff TN-9.3.1-STABLE
如果你在其他地方:
git --git-dir=/tank/home/stable-builds/TN/.git --work-tree=/tank/home/stable-builds/FN diff TN-9.3.1-STABLE
来自 git 手册:
--git-dir=<path>
Set the path to the repository.
--work-tree=<path>
Set the path to the working tree.
git diff origin/9.3.1-STABLE TN-9.3.1-STABLE
这对我有用,实际上 origin/9.3.1-STABLE 和 TN-9.3.1-STABLE 是同一个仓库中的分支。
当我发布这个问题时,我认为 9.3.1-STABLE 和 TN-9.3.1-STABLE 是不同的回购协议,如果有任何混淆,我们深表歉意。
# git diff --stat origin/9.3.1-STABLE TN-9.3.1-STABLE
ChangeLog | 26 +++++-
Makefile | 12 +--
README.md | 6 +-
ReleaseNotes | 97 ++++------------------
build/README | 6 +-
build/create_redmine_changelog.py | 4 +-
build/files/install.sh | 4 +-
build/nanobsd-cfg/FREENAS.amd64 | 3 -
build/nanobsd-cfg/Files/etc/rc.conf.local | 7 +-
^^^ 将只为您提供更改的文件,以及完整路径,您可以执行类似下面的操作以清楚地了解到底发生了什么变化以及在哪里。
# git diff origin/9.3.1-STABLE:ChangeLog TN-9.3.1-STABLE:ChangeLog
diff --git a/origin/9.3.1-STABLE:ChangeLog b/TN-9.3.1-STABLE:ChangeLog
index 35e315e..656c681 100644
--- a/origin/9.3.1-STABLE:ChangeLog
+++ b/TN-9.3.1-STABLE:ChangeLog
@@ -1,2 +1,24 @@
-#11936 Bug Critical UI left pane does not populate
-#12208 Bug Critical Fix late-breaking issue with ntpd update
+o Add a vCenter plugin. This functionality allows you to install
+ the TrueNAS 1.0 vCenter plugin in to vCenter, which will then
+ allow you to create iSCSI and NFS datastores directly from vCenter.