]>
Commit | Line | Data |
---|---|---|
00a96276 JN |
1 | (ns utils |
2 | (:require [lib :refer [run-cmd]] | |
3 | [clojure.string :as str])) | |
4 | ||
5 | (defn git-pull-rebase-branch | |
6 | "Do git pull and rebase branch with master" | |
7 | [] | |
8 | (let [current-branch (str/trim (run-cmd ["git" "branch" "--show-current"]))] | |
9 | (print (run-cmd ["git" "pull" "--rebase"])) | |
10 | (when (not (contains? #{"master" "main"} current-branch)) | |
11 | (run! print | |
12 | (map run-cmd | |
13 | '[["git" "checkout" "master"] | |
14 | ["git" "pull" "--rebase"] | |
15 | ["git" "checkout" "-"] | |
16 | ["git" "rebase" "master"]]))))) |