tto / docs / git / compare files in different branches

to compare files in different branches, use git diff.

we can compare individual files or the whole branch. diff shows the difference from the point-of-view of the branch:

> git branch
  main
* pprd
  test
  
> git diff main
diff --git a/functions.ps1 b/functions.ps1
index 8bbf315..970a286 100644
--- a/functions.ps1
+++ b/functions.ps1
@@ -1,6 +1,6 @@
 #region variables and resources
 # initialize
-
+# test
 #AzureLogin
 try

> git checkout main
> git diff pprd
diff --git a/functions.ps1 b/functions.ps1
index 970a286..8bbf315 100644
--- a/functions.ps1
+++ b/functions.ps1
@@ -1,6 +1,6 @@
 #region variables and resources
 # initialize
-# test
+
 #AzureLogin
 try

compare files: git diff ..main ./file.ps1

the two dots before main indicate compare current branch to main.