Getting Netlify Large Media Going

I just did this the other day so I figured I'd blog it up. There is a thing called Git Large File Storage (Git LFS). Here's the entire point of it: it keeps large files out of your repo directly. Say you have 500MB of images on your site and they kinda need to be in the repo so you can work with it locally. But that sucks because someone cloning the repo needs to download a ton of data. Git LFS is the answer.

Netlify has a product on top of Git LFS called Large Media. Here's the entire point of it: In addition to making it all easier to set up and providing a place to put those large files, once you have your files in there, you can URL query param based resizing on them, which is very useful. I'm all about letting computers do my image sizing for me.

You should probably just read the docs if you're getting started with this. But I ran into a few snags so I'm jotting them down here in case this ends up useful.

You gotta install stuff

I'm on a Mac, so these are the things I did. You'll need:

  1. Git LFS itself: brew install git-lfs
  2. Netlify CLI: npm install netlify-cli -g
  3. Netlify Large Media add-on for the CLI: netlify plugins:install netlify-lm-plugin and then netlify lm:install

"Link" the site

You literally have to auth on Netlify and that connects Netlify CLI to the site you're working on.

netlify link

It will create a .netlify/state.json file in your project like this:

{
	"siteId": "xxx"
}

Run setup

netlify lm:setup

This creates another file in your project at .lsfconfig:

[lfs]
	url = https://xxx.netlify.com/.netlify/large-media

You should commit them both.

"Track" all your images

You'll need to run more terminal commands to tell Netlify Large Media exactly which images should be on Git LFS. Say you have a bunch of PNGs and JPGs, you could run:

git lfs track "*.jpg" "*.png"

This was a minor gotcha for me. My project had mostly .jpeg files and I got confused why this wasn't picking them up. Notice the slightly different file extension (ughadgk).

This will make yet another file on your project called .gitattributes. In my case:

*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text

This time, when you push, all the images will upload to the Netlify Large Media storage service. It might be an extra-slow seeming push depending on how much you're uploading.

My main gotcha was at this point. This last push would just spin and spin for me and my Git client and eventually fail. Turns out I needed to install the netlify-credential-helper. It worked fine after I did that.

And for the record, it's not just images that can be handled this way, it's any large file. I believe they are called "binary" files and are what Git isn't particularly good at handling.

Check out your repo, the images are just pointers now

Git repo where a JPG file isn't actually an image, but a small text pointer.

And the best part

To resize the image on-the-fly to the size I want, I can do it through URL params:

<img 
  src="slides/Oops.003.jpeg?nf_resize=fit&w=1000"
  alt="Screenshots of CSS-Tricks and CodePen homepages"
/>

Which is superpowered by a responsive images syntax. For example...

<img srcset="img.jpg?nf_resize=fit&w=320 320w,
             img.jpg?nf_resize=fit&w=480 480w,
             img.jpg?nf_resize=fit&w=800 800w"
      sizes="(max-width: 320px) 280px,
             (max-width: 480px) 440px,
             800px"
        src="img.jpg?nf_resize=fit&w=800" alt="Elva dressed as a fairy">

The post Getting Netlify Large Media Going appeared first on CSS-Tricks.

Using Conventional Commit in Projects

In this post, we will explore how to use conventional commit as well as the benefits of using it in your projects. Let's get started.

What Is It?

Conventional commit is a commit message standard first proposed by the Angular team to make their commit message uniform across different developers' check-ins. This standard gives a certain structure to commit and is helpful in building tools on top of commit messages. 

Using Git in Business and Government

Synopsis: Git is the best we have right now for a "History-retaining Merkle tree" (when force-push is turned off), and stands to be utilized more outside of software development - in business at least.

A £200m "Garden Bridge" project was canceled when it had accrued £50m in costs and before construction started. It is difficult to pick it apart. See this Tortoise Media article and Reddit discussion.

Git Branching: Don’t (Always) Follow the Best Practices

A debatable headline, I agree, but I will explain what it means and I hope that by the end of this short article, you will be equipped with enough parameters to chose your branching and versioning strategy and not make your decisions based purely on best practices.

Gitflow has become the de facto branching strategy for most, if not all, modern companies, and there is not a shred of doubt that it works wonders if properly adhered to. Gitflow is an exhaustive model that encompasses the branching needs of products following varied software development lifecycles, be it a bi-weekly release cycle or a half-yearly release cycle, and that is where my concern lies — it covers everything, and in my opinion, this 'one size fits all' branching model does not work in every situation. It can create process barriers and actually slow down the team.

Git Strategies for Software Development: Part 2

Please go through the earlier article before reading this article. I will assume the strategy defined in first article is clear before reading ahead. This article will focus on multiple releases in parallel. A software team working on two or more releases at a time may refer to this strategy.

Let’s consider two releases starting in parallel from today.

Graphical User Interfaces for Git

Git is command-line-driven software, but that doesn't mean you have to use the command line to make it work. There are lots of options! Some of the deepest programmer nerds I know prefer to use GUIs for Git (Graphic
User Interface, or you know, software you can see things and click stuff), and some near pure-designers I know prefer working with the command line for Git. Swear to Git.

Lemme round up what look like the major players for Git GUIs these days.


Tower

I've used Tower for ages and it's the one used the most. I'm not sure the exact release dates of all these, but I feel like Tower was an early player here. They've been around a long time and continuously improve, which I always respect.



Fork

It's free and actively developed, incredibly.



GitHub Desktop

This is a 2.0 of the original GitHub Desktop. I had some gripes with the 1.0 version in that its terminology was weird (to me) and seemed to vastly deviate from Git, which was more confusing than it was worth (again, to me). This version cleans most of that up. It's deeply integrated into GitHub so it makes GitHubb-y things (e.g. pull requests) feel like first-class citizens, but it will still happily work with any Git repo.



GitKraken

I'm pretty intrigued by this one. Upgrading (monthly cost) to get the in-app merge conflict tool seems worth it, but you also have to upgrade to access private repos. It seems highly feature rich, but I think my favorite part is the dark-with-rainbow-accent-colors theme.



Sourcetree

You might be compelled by Sourcetree if you're a big Bitbucket user because they are both Atlassian products. I know it works for any Git repo though. I imagine there is some smooth Bitbucket integration stuff with this, similar to the GitHub/GitHub Desktop connection.



Coda

You don't really think of Coda as a version control tool (it's more of a direct-to-FTP thing), and even though I'd argue the support for it is fairly half-baked, it does work! Seems likely the next evolution of Coda will address this.



VS Code

Having version control right in your IDE like this, to me, feels like kind of a tweener between GUI and CLI. There are a lot of features here, but it's not really a full-blown GUI to me, but you've got a terminal built in right there so it almost encourages that. A lot of Git usage is pretty basic pulling, committing, and pushing — so having this right within the app is kinda sweet.

(I imagine there are lots of other IDEs that offer version control features. PHPStorm, etc.)



The post Graphical User Interfaces for Git appeared first on CSS-Tricks.

How to Find Bugs With git bisect

In this post, I’m going to talk about git bisect and how it helps finding buggy commits or those that don’t meet some kind of requirement. By using it, git will suggest commits where a breaking change might be introduced. Let’s see how we can use it.

Let’s say we have a Go project in a git repo with this history:

Using SourceGear DiffMerge With TFS in Visual Studio and Git

This post isn't to advocate DiffMerge over another file comparer, but an explanation on how to set up DiffMerge with either TFS in Visual Studio or Git.

I've been using DiffMerge since VS2010, so pretty much forever as far as I am concerned. Back then there was no built-in diff viewer in Visual Studio so you had to use a third-party tool. Because I've used it for so long I'm quite reluctant to change. Looking at differences in files is something every developer does often, whether it is local code changes or a code review for another member of the team. It has to be a quick and efficient process. That's why I stick with DiffMerge. I know it works, I know how to use it, I'm familiar with the layout, and I can quickly navigate and scan the document.

Use Version Control for Everything

Version control is an important part of file management on every software development project I've ever worked on in the last two decades, regardless of the methodology. I've used Subversion and Git and several others in the process of building software.

I always find it a bit surprising that other industries don't use version control nearly as much as we do in the software industry. For example, I know several writers who know nothing about version control and they would benefit greatly from it. The same is true for several artists and graphics designers who I know. I find that version control it is extremely easy to work with and gives me some key benefits.

Securing Developer Workflows

A few weeks ago, Weaveworks and Snyk delivered a webinar, entitled, "Secure GitOps pipelines for Kubernetes." The theme of the webinar was on how to improve the security of your development workflows — from Git to production.

Brice Fernandes, Customer Success Engineer at Weaveworks kicked off the talks with an in-depth look on what GitOps is and how it improves the overall security of your CICD pipelines.

Jenkins: Deploying Projects from Git with Submodules

Introduction

To some, the word "submodules" strikes fear into the very heart of those developers who dare speak or hear it.

Ok, maybe it isn't that bad: Submodules can be a great way to tie together and deploy your services, especially in a microservices environment.

Working Out When Something Broke Using Git Bisect and Git Log

On Feb, 5 I attended DDD North. There were many excellent talks, but, in this post, I'm delving into something that I saw in one of the grok talks (I gave one myself). It concerns a feature of git that I'd never heard about until then, and it's proved to be enormously useful. This post is, as all of my posts are, really for myself.

You're giving the app a quick test, and suddenly you realize that something in the application has stopped working (or maybe it's started, but it shouldn't have). You remember that two days ago, this particular thing was working fine. This post is going to cover manually using git bisect to determine when your code was broken.

10 Courses to Learn DevOps Engineering in Depth

DevOps is really hot at this moment and there are many job opportunities for distinguished engineers and DevOps professionals. If you want to become a DevOps engineer, then you have come to the right place. In this article, I am going to share some of the best online training courses you can take to become a DevOps professional.

The most important advantage of DevOps is that it helps you to deliver better software and provide more control over your environment and software development process with the help of modern tools and automation. That's the reason the demand for DevOps professionals is growing exponentially. It's also one of the highest-paying IT jobs, along with data science and machine learning specialists.

Git Operations With Visual Studio, Part 2

Introduction

Today, I will show some more advanced Git operations using Visual Studio, without using the Git command line tool. This is the second part of the "Git Operation With Visual Studio" series. Please read the first article here. In the previous article, we have seen Git basic operations like creating repository and branch, cloning, commit, push changes, and more. Now, in this article, I will explain how to merge the branches and resolve the conflicts if any.

Update Local Branch

Update the local repository/branch to get changes from other members who have already made changes and merged. To update the code to keep it synced with others, there are three operations that come into the picture.

How to Tidy Up Your Merge Requests With Git

I've worked on a lot of open source projects and one thing they all have in common is when you create a merge request (or pull request) they will often ask, "Can you clean up your request?" because commits like fix typo should not be included in a Git history.

Now there are a few ways of cleaning up commits and I'll show you what I have found to be the easiest way.

10 Essential Tools Every Java Developers Should Know

Hello, folks! We are already in the second month of 2019, and I am sure all of you have already made your goals about what to learn in 2019 and how to achieve them. I have been writing a series of articles to give you some ideas about the things you can learn and improve upon to become a better, well-rounded developer in 2019, learning new programming languages, frameworks, and libraries. These three things are extremely important to help you become a better Java developer, but as a wise person once said, "you are only as good as your tools." You should also look to upgrade your tools, learn new tools, and improve your understanding of old tolls that are still working well.

To help you with what tools you can learn in 2019, I have come up with this list of 10 essential tools for Java developers that I am going to share with you guys in this article. In the past, I have shared some useful testing tools for Java programmers, and this article is an extension of that, as it covers much more than automation testing tools.