소스 검색

add a release-branch sync tool

Sam Jaffe 3 년 전
부모
커밋
dd999563f9
1개의 변경된 파일22개의 추가작업 그리고 0개의 파일을 삭제
  1. 22 0
      profile-git

+ 22 - 0
profile-git

@@ -26,6 +26,28 @@ git-create() {
   git commit -m "${message}"
 }
 
+git-sync-release() {
+  rel="release/${1}"
+  br="$(git branch | grep '^\*' | cut -c3-)"
+
+  # Confirm that this is a real branch
+  (git branch -r | grep "${rel}" &>/dev/null) || return 1
+
+  # Merge dev
+  # Make sure that we're not doing a weird clobber
+  git checkout "${rel}" || return 2
+  # Sanity check...
+  git pull
+  git merge --ff-only origin/dev || return 3
+
+  # Update origin:release
+  git push
+  git checkout "${br}"
+
+  # Don't delete if we're on this branch
+  [[ "${br}" == "${rel}" ]] || git branch -D "${rel}"
+}
+
 alias git-graph="git log --graph --pretty=oneline --abbrev-commit --decorate --all"
 alias git-history-graph="git log --graph --pretty='format:%C(auto)%h (%<(50,trunc)%s, %ad)%d' --abbrev-commit --decorate --all"