diff --git a/README.md b/README.md index 2dacb8e..1f3a086 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`. * [List all branch is WIP](#list-all-branch-is-wip) * [Find guilty with binary search](#find-guilty-with-binary-search) * [Bypass pre-commit and commit-msg githooks](#bypass-pre-commit-and-commit-msg-githooks) +* [List commits and changes to a specific file (even through renaming)](#list-commits-and-changes-to-a-specific-file-even-through-renaming) @@ -706,14 +707,14 @@ git checkout master && git branch --no-merged ``` ## Find guilty with binary search - ```sh -git bisect start # Search start -git bisect bad # Set point to bad commit -git bisect good v2.6.13-rc2 # Set point to good commit|tag -git bisect bad # Say current state is bad -git bisect good # Say current state is good -git bisect reset # Finish search +git bisect start # Search start +git bisect bad # Set point to bad commit +git bisect good v2.6.13-rc2 # Set point to good commit|tag +git bisect bad # Say current state is bad +git bisect good # Say current state is good +git bisect reset # Finish search + ``` ## Bypass pre-commit and commit-msg githooks @@ -721,5 +722,10 @@ git bisect reset # Finish search git commit --no-verify ``` +## List commits and changes to a specific file (even through renaming) +```sh +git log --follow -p -- +``` + diff --git a/tips.json b/tips.json index d0dddd6..e28f846 100644 --- a/tips.json +++ b/tips.json @@ -277,7 +277,7 @@ "tip": "git log Branch1 ^Branch2" }, { "title": "reuse recorded resolution, record and reuse previous conflicts resolutions.", - "tip":"git config --global rerere.enabled 1" + "tip": "git config --global rerere.enabled 1" }, { "title": "Open all conflicted files in an editor.", "tip": "git diff --name-only | uniq | xargs $EDITOR" @@ -285,40 +285,42 @@ "title": "Count unpacked number of objects and their disk consumption.", "tip": "git count-objects --human-readable" }, { - "title": "Prune all unreachable objects from the object database.", - "tip": "git gc --prune=now --aggressive" -},{ - "title": "Instantly browse your working repository in gitweb.", - "tip": "git instaweb [--local] [--httpd=] [--port=] [--browser=]" -},{ - "title": "View the GPG signatures in the commit log", - "tip": "git log --show-signature" + "title": "Prune all unreachable objects from the object database.", + "tip": "git gc --prune=now --aggressive" +}, { + "title": "Instantly browse your working repository in gitweb.", + "tip": "git instaweb [--local] [--httpd=] [--port=] [--browser=]" +}, { + "title": "View the GPG signatures in the commit log", + "tip": "git log --show-signature" }, { "title": "Remove entry in the global config.", "tip": "git config --global --unset " -},{ +}, { "title": "Checkout a new branch without any history", "tip": "git checkout --orphan " -},{ - "title": "File diff between staging and the last file version.", - "tip": "git diff --staged" -},{ - "title": "Extract file from another branch.", - "tip": "git show :" }, { - "title": "List only the root and merge commits.", - "tip": "git log --first-parent" + "title": "File diff between staging and the last file version.", + "tip": "git diff --staged" }, { - "title": "Merge previous two commits into one.", - "tip": "git rebase --interactive HEAD~2" + "title": "Extract file from another branch.", + "tip": "git show :" }, { - "title": "List all branch is WIP", - "tip": "git checkout master && git branch --no-merged" + "title": "List only the root and merge commits.", + "tip": "git log --first-parent" +}, { + "title": "Merge previous two commits into one.", + "tip": "git rebase --interactive HEAD~2" +}, { + "title": "List all branch is WIP", + "tip": "git checkout master && git branch --no-merged" +}, { + "title": "Find guilty with binary search", + "tip": "git bisect start # Search start \ngit bisect bad # Set point to bad commit \ngit bisect good v2.6.13-rc2 # Set point to good commit|tag \ngit bisect bad # Say current state is bad \ngit bisect good # Say current state is good \ngit bisect reset # Finish search \n" }, { - "title": "Find guilty with binary search", - "tip": "git bisect start # Search start \ngit bisect bad # Set point to bad commit \ngit bisect good v2.6.13-rc2 # Set point to good commit|tag \ngit bisect bad # Say current state is bad \ngit bisect good # Say current state is good \ngit bisect reset # Finish search \n" -}, - { "title": "Bypass pre-commit and commit-msg githooks", "tip": "git commit --no-verify" - }] +}, { + "title": "List commits and changes to a specific file (even through renaming)", + "tip": "git log --follow -p -- " +}]