diff options
-rw-r--r-- | git.cheat | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -15,5 +15,28 @@ git branch -d <branch> # Get the remote url of origin git remote get-url origin +# Diff a specific file between commits +git diff \ + --color-words \ + --ignore-space-change \ + <start_commit_id>..<end_commit_id> \ + -- <files_changed_between_commits> + +# Diff files changed compared to master branch +git diff \ + --color-words \ + --ignore-space-change \ + -- <files_changed_compared_to_master_branch> + +# Show the files changed compare to master branch +git diff --stat --merge-base <master_branch> + $ commit_id: git log --pretty=reference --- --column 1 --delimiter '\s' $ branch: git branch | awk '{print $NF}' + +$ start_commit_id: git log --pretty=reference --- --column 1 --delimiter '\s' +$ end_commit_id: git log --pretty=reference --- --column 1 --delimiter '\s' +$ files_changed_between_commits: git diff --name-only <start_commit_id>..<end_commit_id> + +$ master_branch: git symbolic-ref --short refs/remotes/origin/HEAD +$ files_changed_compared_to_master_branch: git diff --name-only --merge-base <master_branch> |