build(build):add push.sh
This commit is contained in:
parent
4cea7ddd92
commit
643879bc1e
|
@ -0,0 +1,78 @@
|
||||||
|
#
|
||||||
|
# NOTE! Don't add files that are generated in specific
|
||||||
|
# subdirectories here. Add them in the ".gitignore" file
|
||||||
|
# in that subdirectory instead.
|
||||||
|
#
|
||||||
|
# NOTE! Please use 'git ls-files -i --exclude-standard'
|
||||||
|
# command after changing this file, to see if there are
|
||||||
|
# any tracked files which get ignored after the change.
|
||||||
|
#
|
||||||
|
# Normal rules
|
||||||
|
#
|
||||||
|
.*
|
||||||
|
*.o
|
||||||
|
*.o.*
|
||||||
|
*.s
|
||||||
|
*.so.dbg
|
||||||
|
*.mod.c
|
||||||
|
*.i
|
||||||
|
*.lst
|
||||||
|
*.symtypes
|
||||||
|
*.order
|
||||||
|
*.elf
|
||||||
|
*.tar
|
||||||
|
*.gz
|
||||||
|
*.bz2
|
||||||
|
*.lzma
|
||||||
|
*.xz
|
||||||
|
*.lz4
|
||||||
|
*.lzo
|
||||||
|
*.gcno
|
||||||
|
*.dwo
|
||||||
|
*.su
|
||||||
|
*.swo
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
#
|
||||||
|
# Top-level generic files
|
||||||
|
#
|
||||||
|
/tags
|
||||||
|
/TAGS
|
||||||
|
|
||||||
|
#
|
||||||
|
# git files that we don't want to ignore even it they are dot-files
|
||||||
|
#
|
||||||
|
!.gitignore
|
||||||
|
!.mailmap
|
||||||
|
|
||||||
|
# cscope files
|
||||||
|
cscope.*
|
||||||
|
ncscope.*
|
||||||
|
|
||||||
|
# gnu global files
|
||||||
|
GPATH
|
||||||
|
GRTAGS
|
||||||
|
GSYMS
|
||||||
|
GTAGS
|
||||||
|
|
||||||
|
# id-utils files
|
||||||
|
ID
|
||||||
|
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
\#*#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Leavings from module signing
|
||||||
|
#
|
||||||
|
extra_certificates
|
||||||
|
signing_key.pem
|
||||||
|
signing_key.priv
|
||||||
|
signing_key.x509
|
||||||
|
x509.genkey
|
||||||
|
|
||||||
|
# Kconfig presets
|
||||||
|
all.config
|
||||||
|
|
||||||
|
# Kdevelop4
|
||||||
|
*.kdev4
|
|
@ -0,0 +1,42 @@
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 配置凭据帮助器,以缓存凭据(输入一次密码后,之后的推送不再需要密码)
|
||||||
|
git config --global credential.helper store
|
||||||
|
|
||||||
|
# 获取当前目录下的所有子模块路径,并移除主仓库名字
|
||||||
|
submodules=$(git submodule foreach --recursive --quiet 'echo "$PWD/$path"')
|
||||||
|
|
||||||
|
# 移除路径中的最后一个文件夹
|
||||||
|
submodules=$(echo "$submodules" | xargs -I{} dirname {} | sort | uniq)
|
||||||
|
|
||||||
|
# 去掉根目录
|
||||||
|
root_dir=$(git rev-parse --show-toplevel)
|
||||||
|
submodules=$(echo "$submodules" | sed "s|$root_dir/||")
|
||||||
|
commit_message=""
|
||||||
|
# 循环遍历子模块并检查是否有待提交的更改
|
||||||
|
for submodule in $(echo "$submodules" | tac);
|
||||||
|
do
|
||||||
|
# 进入目录
|
||||||
|
cd "$root_dir/$submodule" || exit
|
||||||
|
# 检查是否有未提交的更改
|
||||||
|
if [[ -n $(git status --porcelain) ]]; then
|
||||||
|
# 接受用户输入的 commit message
|
||||||
|
read -p "Enter commit message for $submodule: " commit_message
|
||||||
|
# 执行 git add 和 git commit
|
||||||
|
git add .
|
||||||
|
git commit -m "$commit_message"
|
||||||
|
# 执行 git push
|
||||||
|
git push
|
||||||
|
cd $root_dir
|
||||||
|
else
|
||||||
|
echo "No changes in $submodule"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 如果有顶层仓库的更改需要提交,则进行提交和推送
|
||||||
|
echo "Pushing changes in top submodule:$commit_message"
|
||||||
|
# 接受用户输入的 commit message
|
||||||
|
git add $submodule
|
||||||
|
git commit -m "$commit_message"
|
||||||
|
git push
|
Loading…
Reference in New Issue