Now Reading
See the Historical past of a Technique with git log -L

See the Historical past of a Technique with git log -L

2023-11-05 11:28:47


See the Historical past of a Technique with git log -L












Git can “hint the evolution” of a selected methodology when handed -L utilizing the :<funcname> variant. Let’s check out the historical past of this weblog’s posts’ revealed scope, which is utilized in most locations that articles are listed out. You may see that git is ready to establish the boundaries of the tactic even because the size adjustments and it prints out the total methodology with diff from every commit within the log, which is filtered to adjustments to that methodology.

$ git log -L :self.revealed:app/fashions/submit.rb -n3
commit d1fbdf3b9a5bd37dd49d61c61ee0f51c75fdb806
Creator: Caleb Fireplace <caleb@calebhearth.com>
Date:   Thu Feb 2 16:36:34 2023 -0700

    Decree, LFW, new homepage, RSS-only posts

diff --git a/app/fashions/submit.rb b/app/fashions/submit.rb
--- a/app/fashions/submit.rb
+++ b/app/fashions/submit.rb
@@ -15,6 +15,6 @@
   def self.revealed
     all
-      .reject { _1.frontmatter[:draft] }
+      .reject 
       .choose { _1.date <= Date.at this time }
   finish


commit 37a830b625db4e60e0ffbfec881d693369706169
Creator: Caleb Fireplace <caleb@calebhearth.com>
Date:   Fri Nov 12 11:39:48 2021 -0600

    Publish posts revealed at this time

diff --git a/app/fashions/submit.rb b/app/fashions/submit.rb
--- a/app/fashions/submit.rb
+++ b/app/fashions/submit.rb
@@ -15,6 +15,6 @@
   def self.revealed
     all
       .reject { _1.frontmatter[:draft] }
-      .choose { _1.date < Date.at this time }
+      .choose { _1.date <= Date.at this time }
   finish


commit b1ed34a897af9ff2f882e140132a6e6045257b10
Creator: Caleb Fireplace <caleb@calebhearth.com>
Date:   Mon Nov 1 10:33:13 2021 -0500

    Do not filter out all posts

diff --git a/app/fashions/submit.rb b/app/fashions/submit.rb
--- a/app/fashions/submit.rb
+++ b/app/fashions/submit.rb
@@ -12,6 +15,6 @@
   def self.revealed
     all
-      .reject  submit.frontmatter[:draft] 
-      .reject  submit.frontmatter[:date] < Date.at this time 
+      .reject { _1.frontmatter[:draft] }
+      .choose { _1.date < Date.at this time }
   finish

In case you obtained excited and tried this by yourself, you might have been disillusioned to see a message like

deadly: -L parameter 'self.revealed' beginning at line 1: no match

Whereas Git is aware of how to do that for some languages (principally the C household), it wants a little bit of assist for lots of others together with Ruby and Swift. Fortuitously it’s so simple as including one these strains (you solely want the one related to your venture’s language) to your venture’s .gitattributes

*.rb diff=ruby
*.swift diff=swift

In case you’d like this to be international so that you don’t get that error in every new venture, you’ll be able to arrange a worldwide .gitattributes file for your self like this:

$ git config --global core.attributesfile ~/.gitattributes

Then add the above strains to ~/.gitattributes.

See Also

See the Historical past of a Technique with git log -L is a part of the NaBloPoMo sequence.

©

Caleb Fireplace.

Made with ♥ in Denver, CO.
Blissful Sunday!

Source Link

What's Your Reaction?
Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top