tcler's blog --- 其实我是一个程序员
Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious.

git repo: force sync from upstream

git repo: force sync from upstream

#https://stackoverflow.com/questions/9646167/clean-up-a-fork-and-restart-it-from-the-upstream

forceSyncFromUpstream() {
  local uprepo=$1
  #local master=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
  local master=$(git branch | grep -o -m1 "\b\(master\|main\)\b")

  git remote add upstream $uprepo
  git fetch upstream
  git checkout ${master}
  git reset --hard upstream/${master}  
  git push origin ${master} --force
}

repofrom=
forceSyncFromUpstream $repofrom