Author | Linus Torvalds |
Maintainer(s) | |
Released | 2005 |
Source | git.git |
Homepage | git.web |
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
list top 10 contributers to the project:
~$ git log --format='%aN' | sort | uniq -c | sort -rn | head
list top 10 version tags:
~$ git tag | sort -Vr | head
list files are being tracked on master branch:
~$ git ls-tree -r master --name-only
list files that ever existed including deleted files:
~$ git log --pretty=format: --name-only --diff-filter=A | sort - | sed '/^$/d'
completely remove tracked files from git history:
#!/usr/bin/env bash
# Wild card, regex list of files to be removed from git tracking
RM_LST=(
"cache"
"host_vars/.*yml"
"generated/.*yml"
)
get_rm_lst()
{
local rm_file="$1"
git log \
--pretty=format: \
--name-only \
--diff-filter=A \
| grep "${rm_file}"
}
flush_git()
{
local rm_file="$1"
git filter-branch \
--force \
--index-filter \
"git rm --cached --ignore-unmatch ${rm_file}" \
--prune-empty \
--tag-name-filter \
cat -- \
--all
}
main()
{
for ff in ${RM_LST[@]}; do
for f in $(get_rm_lst ${ff}); do
echo "$f"
flush_git $f
done
done
}
main "$@"
# End of script
restore accidentally changed files to latest commit:
~$ git status | awk '/modified/{print $2}' | xargs -I{} git restore {}
aws xargs