Git: diff двух репозиториев

By | 08/26/2016
 

git-logoИмеется один репозиторий, WebApp в Azure:

$ git remote -v show
origin  https://gituser@application.scm.azurewebsites.net:443/application.git (fetch)
origin  https://gituser@application.scm.azurewebsites.net:443/application.git (push)
$ git branch
* master

И второй, в Github:

$ git remote -v show
origin  git@github.com:jm-application/application.git (fetch)
origin  git@github.com:jm-application/application.git (push)
$ git branch
  develop
  master
* release
  travis_init

Проблема заключается в том, что приложение в Azure (PROD) и код в репозитории Github – различается (2.700 файлов!).

Для того, что бы выполнить diff между ними – добавляем ссылку на второй репозиторий как remote в первом репозитории отдельным бранчем:

$ git remote add -f jmgithubrelease git@github.com:jm-application/application.git
Updating jmgithubrelease
warning: no common commits
remote: Counting objects: 18286, done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 18286 (delta 15), reused 0 (delta 0), pack-reused 18257
Receiving objects: 100% (18286/18286), 419.00 MiB | 3.66 MiB/s, done.
Resolving deltas: 100% (10887/10887), done.
From github.com:jm-application/application
 * [new branch]      develop    -> jmgithubrelease/develop
 * [new branch]      feature/Band_Gewinnspiel -> jmgithubrelease/feature/Band_Gewinnspiel
...
 * [new branch]      playground -> jmgithubrelease/playground
 * [new branch]      release    -> jmgithubrelease/release

Проверяем:

$ git remote -v
jmgithubrelease git@github.com:jm-application/application.git (fetch)
jmgithubrelease git@github.com:jm-application/application.git (push)
origin  https://gituser@application.scm.azurewebsites.net:443/application.git (fetch)
origin  https://gituser@application.scm.azurewebsites.net:443/application.git (push)

Обновляем:

$ git remote update
Fetching origin
Password for 'https://gituser@application.scm.azurewebsites.net:443':
Fetching jmgithubrelease

И выполняем сравнение между локальным и remote master бранчами:

$ git diff master remotes/jmgithubrelease/master
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..95192a7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,16 @@
+.hg
+
+.hgflow
+
+.hgignore
+
+bin/
+obj/
+*.suo
+server/application/application.CMS/App_Data/
+*.user
+*.csproj.user
+server/application/application.CMS/client/.idea/
+server/application/packages/
+server/.sass-cache/
+/server/application/packages
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..8ca0ab0
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,12 @@
+language: csharp
+solution: server/application/application.sln
+branches:
+  only:
+    - develop
+    - release
+before_script:
+  - git config --global user.email "username@domain.com"
+  - git config --global user.name "Travis-CI"
+script:                                                                                                                                                                                                                                                                       
+  - if [ $TRAVIS_BRANCH = "develop" ]; then echo "DEV deploy"; fi                                                                                                                                                                                               
+  - if [ $TRAVIS_BRANCH = "release" ]; then echo "STAGE deploy"; fi
diff --git a/App_Browsers/Form.browser b/App_Browsers/Form.browser
deleted file mode 100644
index a15cd2c..0000000
--- a/App_Browsers/Form.browser
+++ /dev/null
@@ -1,10 +0,0 @@
-<browsers>
-
-  <browser refID="Default">
-    <controlAdapters>
-      <adapter controlType="System.Web.UI.HtmlControls.HtmlForm"
-               adapterType="umbraco.presentation.urlRewriter.FormRewriterControlAdapter" />
-    </controlAdapters>
-  </browser>
-
-</browsers>
\ No newline at end of file
diff --git a/App_Browsers/w3cvalidator.browser b/App_Browsers/w3cvalidator.browser
deleted file mode 100644
index ab466c8..0000000
--- a/App_Browsers/w3cvalidator.browser
+++ /dev/null
@@ -1,26 +0,0 @@

Теперь можно удалить второй репозиторий:

$ git remote rm jmgithubrelease
$ git remote -v
origin  https://gituser@application.scm.azurewebsites.net:443/application.git (fetch)
origin  https://gituser@application.scm.azurewebsites.net:443/application.git (push)

Готово.