Git

Git Merges Gone Wild: When Sass Compiler Settings Diverge

Here's one of those problems you can file away under the umbrella of DevOps problems nobody really wants to think about. In my case, I stumbled accross this problem while looking at two branches with respective SASS changes--although, this can logically happen with any code that needs to be compiled to an output file and has different standards for how to do that. Today I hit a merge conflict, and my merge tool was telling me that every line of local and remote were completely different. It turned out my coworker and I were compiling our SASS to different output standards; the end result was that my merge tool (GitKraken) crashed and I was effectively unable to see which lines of code had actually diverged. Here's how to stop this from happening to you!

Background: Git Merge Gone Awry

There's not a lot to this: my coworker has been working on her branch; I've been working on my own. The time has come for me to merge my branch into my coworker's. I checkout my coworker's branch to run a git merge and this is what happens: the _overrides.scss file merges successfully but the output files fail. Those output files are compiled by a little program I run called Koala--a SASS compiler.

Bash: A Simple Script for Automating Git Reset

Don't you just hate doing Git Log, sifting through a bunch of commit hashes and then copy-pasting--all so you can reset to an earlier commit? I do--particularly the part where I need to select, copy and then paste the stupid hash. Today was a breaking point, actually. I finally wrote a script that will find the hash I want and pass it to Git Reset for me. My day is finally looking up.

Background

I needed to un-merge a branch today (stakeholders backed out--it happens). This meant reverting my preview branch to a commit just before the merge. This is exactly the kind of thing, I think, that pushes so many devs to graphical Git clients (like, GitKraken, et. al.); doing a reset on the command line is kind of pain. You need to run git log, find the earlier hash for a commit you want to reset to, copy it, and then paste it into a git reset command.

Git: Add, Commit and Push All at Once (Bash Function)

Git is a powerful tool, but sometimes the redundant keystrokes are a pain in the butt. Should you really Add, Commit and Push all in one fell swoop?--No. There are plenty of good reasons not to. Can you? Yes. All it takes is a little scripting with Bash.

Use Case

I love Git. It can sometimes suck the life out of you, though. That may not be the case for everyone. How much time you spend banging your fingers on the command-line kind of depends on your workflow. If you're a front-end dev, for example, and you spend a lot of time tweaking CSS (or SASS, or whatever), a good way to minimize your use of Git is to simply leverage your browser's Developer Tools more efficiently. Another good strategy is to focus on your localhost--reducing the number of pushes you need to make.

Web Developer Workflow: More Useful Linux Bash Aliases

More Bash Alias fun. This time we'll look at Git, Drush and a few others.

Intro

This is a followup to another recent post discussing bash aliases meant to make your web-developer life easier. If this is your first Tango with Bash Aliases, head to that post for an intro to working with aliases. Otherwise--the list goes on!

Bash: A Simple Script for Checking out New Git Branches

I'm feeling particularly nerdy today and I had a little extra time in my schedule. I recently discussed the utility of Bash Aliases; today, I decided go a step further and put together a Bash Script that allows me to build on that power even more. A Bash Script is basically an Alias on steroids, and if you've had any experience with PHP or JavaScript, there's a lot of overlap. Put on your nerd glasses and let's have a look.

Background - Repetitive Processes w/ Git

You may or may not find this script particularly useful--this post is really about the power of bash scripts to help manage workflow. I do, however, find myself checking out new Git branches somewhat frequently. So, with the extra time in my schedule, I decided to have a little fun and see if I could automate some of that Git workflow with a simple script. Checking out a branch with git isn't a particularly complicated process: git checkout -b <branchname>.

Git: Changing Master to Main -- Was it Necessary?

This is probably off topic, since it really has nothing to do with the technicality of the change, and more to do with 'why'. This may even be a controversial topic for some--so if you're not in the mood, feel free to dismiss this post for what it is: academic conjecture on a somewhat politically charged topic.

If you're unfamiliar with this topic, here's some background on GitHub (and now GitLab's) change from "master" to "main".

Web Developer Workflow: Useful Linux Bash Aliases

If you spend a lot of time on the command line, like I do, an important part of your workflow is getting things done both quickly and efficiently. Bash aliases can be extremely helpful in saving you time. This isn't a comprehensive list by any means, but hopefully it serves as a starting point--allowing you to optimize your terminal-based development work.

Intro

I recently talked about bash aliases for managing XAMPP more efficiently. Here are a few more fun ways you can optimize your development workflow on the command-line using aliases. None of this is rocket science, by any measure. Still, if you're new to bash aliases this brief article will hopefully act as an introduction to a new way of using the command-line (and a new way of thinking about workflow, hopefully).

Git: Previewing Multiple Branches in a Single Environment

One of the most difficult aspects of web development has little to do with code: it's called workflow management--and it can mean the difference between hitting Go-Live and adding days or weeks to a project. Things can turn uggly quickly when a finite number of development environments come to odds with exponential requests for code changes. When things get ugly like this, though, Git shines not just as a version control system but as a workflow management tool.

Before I dive hard into the meat of this post, let's get some basic assumptions out of the way--I'm gonna assume that:

Git Error: Unable to Unlink Old <FILE> -- Permission Denied

A branch management error that can seemingly come out of nowhere. Don't worry, there's an easy fix for this one. The key may be in understanding the real power of Sudo in Linux.

TL;DR -- check file permissions; on Linux?--maybe don't use Sudo with Git!

This error is almost definitely a permissions issue. In my case, outlined herein, the problem stemmed from a blatant abuse of sudo. Let's break it all down.

How to Kill your Drupal Site: Database Cache

Juggling Git branches between a Production, Staging, Development and Localhost environment can make for exciting errors every now and then. Drupal often labels these errors as 'unexpected'--an obvious but often unhelfpul label. The culprit is often the database cache--here's a real life walk through of how it might be fixed.

Quick note here: I'm working with Drupal 8--although, the process documented here is more or less the same for Drupal 7 or even Drupal 9...

I recently ran some Drupal module updates on our Development site; one of those updates required a database update--namely, the Google Tag Manager module. I brought down the branch with module updates onto my localhost and then imported a copy of my Production database to continue the work on my computer. Upon loading the site, I encountered an unexpected error: