Useful Git Aliases

If you’re a software developer, you most likely use git. Many people are not aware that you can create an alias for commands. Creating alias will make commands easier to remember and quicker to type. Here are some of my favorite git alias I use on a regular basis.

Short for git status

alias gs="git status"

Quickly commit with wip message

alias wip='git add . && git commit -m "wip"'

Updates your branch and submodules

alias gpa = "!git pull --rebase --prune $@ && git submodule update --init --recursive"

Reset all changes (use with caution)

alias nah="git reset --hard && git clean -df"

 

Leave a comment below on your favorite alias commands.

Laravel, Cloudflare and Trusted Proxies

When using Cloudflare to manage your site, you may notice that if you check the ip address of the request, it will be an ip address from Cloudflare. This is happening because Cloudflare is proxying the request to your server. To get around this issue and get the original request ip, you need to configure trusted proxies in Laravel.

This is important because the throttle middleware checks the request ip and throttles based on ip. If all request look like they are coming from Cloudflare, this will cause issues. Read More

Backup Multiple Laravel Sites

If you’re like me and use Laravel Forge to host multiple websites on a single Digital Ocean server, then you may have run into the issue where you need to backup all the sites on your server. You could run Spatie Laravel Backup package on each site but a better solution would be to just deploy a single backup application to the server so you can backup multiple sites. This means you can backup multiple types of sites including WordPress.

I came across a great article from Tim MacDonald. Check it out here

Another option is to use SnapShooter for all your server backusp including MySql. SnapShooter is a simple tool to enable more frequent backups of major server providers, while also providing support for offsite backups your choose of S3 provider. Monitor your Laravel backups in real time, and easily discover when something goes wrong. Restoring a backup in a hurry can be stressful, we offer a one click restore process. SnapShooter Connects to your server and imports the database, just sit back and wait.

Let me know if you have any questions.