get current branch name: git rev-parse --abbrev-ref HEAD
revert commit: git reset --soft HEAD~1
revert add: git reset HEAD $1
pushing after rebase: git push --force-with-lease
Resources: https://makandracards.com/makandra/12107-git-show-current-branch-name-only
git SSH & golang: https://gist.github.com/dmitshur/6927554
checking for changed files:
MATCH_FILE_LIST=(
filename1
filename2
)
MATCH_FILE_PATTERN=$(printf "|%s" "${MATCH_FILE_LIST[@]}" | cut -c2-)
# change diff command here if there's a better working version than this (that works in CircleCI)
if [[ $(git diff-tree --no-commit-id --name-only -r HEAD | egrep "${MATCH_FILE_PATTERN}" | wc -l) -gt 0 ]]; then
# whatever you want to do here...
fi
commit tracking
git tag FIRST_COMMIT $(git rev-list --max-parents=0 HEAD)
signing commit related
git rebase -S git commit -S