Strona domowa

Witam na mojej prywatnej stronie internetowej!

[If this is all Polish to you, click here: English]

Uwaga: z oczywistych powodów nie mogę zagwarantować swojej nieomylności, choć staram się o zgodność tego, co piszę, z Prawdą. Jest również oczywiste, że nie gwarantuję takiej zgodności w przypadku komentarzy. Umieszczenie linku do strony spoza niniejszego serwisu nie musi oznaczać, że podzielam poglądy autora tej strony, a jedynie, że uważam ją za wartościową z takich czy innych powodów.

Marcin ‘mbork’ Borkowski

2020-01-13 Automatic testing during rebasing

I am already accustomed to hidden gems in Git. Still, finding one is always nice. Recently, I was reading through git-rebase manpage, and two things drew my attention. The fact that one of the examples uses deadbee and fa1afe1 as commit hashes is of course funny, but not that important. What is much more interesting, however, is a feature I’ve never heard of before. Among various “actions” you can perform on commits during git rebase --interactive (you know, pick, edit, squash etc.), there is one which is different than others in that it is not associated with a commit, but may come between commits. You can say e.g. exec make, and when Git gets to this point during rebasing, it will execute make (or whatever command you want, say npm test). If this command exits with non-zero status (which means some kind of failure), Git will stop so that you can fix the problem. This way you can make sure that every commit on master compiles correctly (or even passes the tests). (See the manpage for details.) Very handy!

CategoryEnglish, CategoryBlog, CategoryGit

Comments on this page