--- /dev/null
+(ns utils
+ (:require [lib :refer [run-cmd]]
+ [clojure.string :as str]))
+
+(defn git-pull-rebase-branch
+ "Do git pull and rebase branch with master"
+ []
+ (let [current-branch (str/trim (run-cmd ["git" "branch" "--show-current"]))]
+ (print (run-cmd ["git" "pull" "--rebase"]))
+ (when (not (contains? #{"master" "main"} current-branch))
+ (run! print
+ (map run-cmd
+ '[["git" "checkout" "master"]
+ ["git" "pull" "--rebase"]
+ ["git" "checkout" "-"]
+ ["git" "rebase" "master"]])))))