Git diff to show changes in CSS block across commits -
i have block of css here, part of larger file:
.card-container { font-family: "open sans", sans-serif; display: flex; justify-content: flex-start; flex-wrap: wrap; display: inline-block; width: 12.92em; height: auto; margin-right: 2em; margin-bottom: 4em; border-radius: 0.5em; background-color: #fff; box-shadow: 6px 6px 6px rgba(0,0,0,0.3); position: relative; padding-bottom: 5vh; }
i want display changes on last 2-4 commits in particular code block only.
git diff head head^ ./assets/css/app.css
will let me check whole file
i want show each revision of css, not two. head, head^, head^^ , on.
the output should show 4 different code blocks, ideally date , message of each commit.
i need able focus on code block ".card-container".."padding-bottom: 5vh"; .. wildcard, , 2 strings define start , end of code block.
you can try following one-liner:
git show head~2:path/to/your/file.css | sed -n '/^.card-container \{$/,/^\}$/p'
the command
git show head~2:path/to/your/file.css
will return contents of entire css file in question 2 commits ago (head~2
). then, can pipe output sed
extract css block described in question.
using approach, have run above one-liner once each previous commit. 4 commits, isn't prohibitively large amount of work.
wiki
Comments
Post a Comment