2016-09-26 108 views
1

除了主設備之外,我在中央存儲庫中有一個功能分支垃圾。我的主人是最新的。現在,我想知道落後於我的主分支的分支列表。我知道github/bitbucket中的單個分支選擇具有圖形視圖。但是,在這裏我有50到60個功能分支進行比較。他們中很少有人在主人之前,很少有人與主人保持一致,很少有人在主人之後。如何將分支列表固定到單個文件?列出主設備後面的所有遠程分支

注:我正在使用bitbucket

在此先感謝您。

回答

0

在BitBucket的存儲庫頁面中,左側導航窗格中有一個「分支」選項卡。 Navigation page

點擊它,你會得到所有的分支列出包括領先/落後列,每個分支 enter image description here

0

黑客和谷歌搜索一點點(stackoverflowing,而)就萬事大吉了! - 一個正常工作的bash腳本,它可以完成您想要的任務:創建三個文件,每個類別的分支(後面,最新或超前)。

注意!有一個拉動,所以隱藏你的改變。

git checkout master  
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done #set tracking of all remote branches 
git fetch --all # fetch all remote branches to the local repository 
git pull --all # update all local branches 
for BRANCH in `git branch --list | sed 's/\*//g'` 
do 
    COMMITS_AHEAD_OF_MASTER=`git log master..$BRANCH` 
    if [ -z "$COMMITS_AHEAD_OF_MASTER" ] 
    then 
     COMMITS_BEHIND_MASTER=`git log $BRANCH..master` 
     if [ -z "$COMMITS_BEHIND_MASTER" ] 
     then 
      echo $BRANCH >> up_to_date.txt 
     else 
      echo $BRANCH >> behind.txt 
     fi 
    else 
     echo $BRANCH >> ahead.txt 
    fi 
done