Husband. Father. Software engineer. Ubuntu Linux user.
At SpotX, we manage our codebase with Git. Our commits flow from our develop branch to production, with a code-freeze branch in-between. Like this:
With any web application, it’s really important for developers to know when their code is going out. So they want to know which branch it’s on. To help with this, I created a few simple git aliases that show recent commits a developer has made in any branch. Here are the commands to create them:
$ git config --global alias.my-dev 'rev-list origin/develop ^origin/freeze --author=mike@mikekasberg.com --pretty'
$ git config --global alias.my-freeze 'rev-list origin/freeze ^origin/prod --author=mike@mikekasberg.com --pretty'
$ git config --global alias.my-prod 'rev-list origin/prod --author=mike@mikekasberg.com --pretty --after="14 days ago"'
Using them is easy!
$ git fetch
$ git my-freeze
commit bebba3afb108719bbdc500cb3dce50ffc062f060
Author: Mike Kasberg <mike@mikekasberg.com>
Date: Sun Apr 30 13:15:15 2017 -0600
Write more code... Make another commit
commit 00a54a1d6cc80a7103389bc813c6d76c2014cd85
Author: Mike Kasberg <mike@mikekasberg.com>
Date: Sat Apr 29 11:16:44 2017 -0600
Write some code... Make a commit
This is a really simple way to use a git alias to make branch management a little easier. With slight modification, it will help with pretty much any branching strategy - for example, you could get a list of commits written by you on a feature branch that are not yet in master:
$ git config --global alias.my-feature-commits 'rev-list origin/feature ^origin/master --author=mike@mikekasberg.com --pretty'
With a little customization, you can make an alias like this to help out with your own projects.
👋 Hi, I'm Mike! I'm a husband, I'm a father, and I'm a senior software engineer at Strava. I use Ubuntu Linux daily at work and at home. And I enjoy writing about Linux, open source, programming, 3D printing, tech, and other random topics. I'd love to have you follow me on X or LinkedIn to show your support and see when I write new content!
I run this blog in my spare time. There's no need to pay to access any of the content on this site, but if you find my content useful and would like to show your support, buying me a coffee is a small gesture to let me know what you like and encourage me to write more great content!
You can also support me by visiting LinuxLaptopPrices.com, a website I run as a side project.