Git: Branches

Материал из База знаний QPAM
Версия от 15:26, 7 марта 2024; A via Felix! (обсуждение | вклад) (Новая страница: «* Обновить все локальные ветки по remote-веткам ‎<syntaxhighlight lang="bash"> #!/bin/sh git for-each-ref --shell --format="%(r…»)

(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск
  • Обновить все локальные ветки по remote-веткам
#!/bin/sh
git for-each-ref --shell --format="%(refname:short)" refs/heads | tac | tr -d "'" | while read branch_name; \
do
    echo ${branch_name}
    git checkout ${branch_name}
    git pull
done
git checkout master
 
# rebase all but master:
git checkout master; git fetch origin --prune; git merge; for branch_name in $(git for-each-ref --shell --format='%(refname:short)' refs/heads | head -n -1 | tac | xargs); do git checkout ${branch_name}; git rebase master; git push origin -f; done; git checkout master
‎