#!/usr/bin/env ruby# encoding: utf-8puts"Please input the branch to unmerge-ignore"targetBranch=gets.chompputs"You want to ignore this branch:#targetBranch, Are you sure? (input yes)"confirm=gets.chompif(confirm=="yes")newBranchName="unmerge_ignore_#targetBranch"system"git branch -m #targetBranch#newBranchName"puts"changed #targetBranch into #newBranchName"end
使用上面的脚本,就能够以命令交互的形式忽略某个分支
123456
~:/ ruby ignoreBranchWhenUnmerged.rb
Please input the branch to unmerge-ignore
new_account_sys
You want to ignore this branch:new_account_sys, Are you sure? (input yes)yes
changed new_account_sys into unmerge_ignore_new_account_sys