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

Материал из База знаний QPAM
Перейти к: навигация, поиск
(Новая страница: «‎<syntaxhighlight lang="bash"> #!/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_COMM…»)
 
Строка 1: Строка 1:
 +
* Указать время в коммите:
 
‎<syntaxhighlight lang="bash">
 
‎<syntaxhighlight lang="bash">
 
#!/bin/sh
 
#!/bin/sh
 
# 'Fri May 7 00:30:45 2021 +0300'
 
# '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"
 
THE_TIME=$(date --rfc-email -d "-0 days -5 hours") GIT_AUTHOR_DATE=$THE_TIME GIT_COMMITTER_DATE=$THE_TIME git commit -m "$1"
 +
‎</syntaxhighlight>
 +
 +
* Обновить все локальные ветки по remote-веткам
 +
‎<syntaxhighlight lang="bash">
 +
#!/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
 
‎</syntaxhighlight>
 
‎</syntaxhighlight>

Версия 15:29, 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
‎