Loading...

Jammie Mountz

Software Engineer

Bash Script to Open Files Changed Between Recent Commits

I work between a handful of branches a day, and I need to switch between them often. It’s annoying to have to find the relevant files for a branch every time between switching. Here’s a handy solution to throw into your bash profile –

[code lang=”shell”]
alias gimme="git diff –name-only HEAD~1 HEAD | xargs atom"
[/code]

 

The command uses git to compare files edited between your most recent commit and your second most recent commit, and then pipes it into Atom (or you could use any text editor). This means I’ll automatically be looking at the files that are most likely going to help remind me what I was doing, and get me working faster.

Fluent in Spanish and JavaScript, salsa dancer, lover of material design.

Living in San Francisco, CA