Bash — различия между версиями

Материал из База знаний QPAM
Перейти к: навигация, поиск
Строка 10: Строка 10:
 
#!/bin/sh
 
#!/bin/sh
 
git for-each-ref --shell --format='%(refname:short)' refs/heads | tac | while read branch_name; do echo ${branch_name}; git pull; done; git checkout master
 
git for-each-ref --shell --format='%(refname:short)' refs/heads | tac | while read branch_name; do echo ${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
 
‎</syntaxhighlight>
 
‎</syntaxhighlight>

Версия 15:44, 17 января 2024

  • Указать время в коммите:
#!/bin/sh
# 'Fri May 7 00:30:45 2021 +0300'
THE_TIME=$(date --rfc-email -d "-0 days -5 hours") GIT_AUTHOR_DATE=$THE_TIME GIT_COMMITTER_DATE=$THE_TIME git commit -m "$1"
  • Обновить все локальные ветки по remote-веткам
#!/bin/sh
git for-each-ref --shell --format='%(refname:short)' refs/heads | tac | while read branch_name; do echo ${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
‎