1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

複数のディレクトリのコミッターを出力するだけ

1
Posted at

複数のディレクトリの中にcdして最後にコミットした人を出力するだけ、なんかもっと綺麗にできる気がして仕方がない。

default_dir=`pwd`

git_list=`cat list.txt`
for var in $git_list
do
	cd ${var}
	
	# for var2 in `git branch -a | grep remotes | grep -v HEAD`
	# for var2 in `git branch -a | grep remotes | grep -v HEAD | grep -v remotes/origin/develop | grep -v remotes/origin/master`
	for var2 in `git branch -a | grep remotes | grep -v HEAD`
	do

		#var_author=`git log -n1 ${var2} | grep Author | sed 's/\([^<]*\)<\([^>].*\)>/\2/g'`
		var_author=`git log -n1 ${var2} --pretty=format:"%ae"`
		#awk '{print $2}'`
		#var_date=`git log -n1 ${var2} | grep Date | awk '{print $3,$4,$5,$6}'`
		var_date=`git log -n1 ${var2} --pretty=format:"%ad" --date=iso | awk '{print $1,$2}'`

		branch_name=`echo ${var2} | sed -e "s/remotes\/origin\///"`
		echo ${var},${branch_name},${var_author},${var_date}

	done

	cd ${default_dir}

done
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?