Skip to content

Instantly share code, notes, and snippets.

@xbalaji
Last active February 13, 2024 03:40
Show Gist options
  • Select an option

  • Save xbalaji/bf556e6eafc4f1df00d7c2eb66217a9d to your computer and use it in GitHub Desktop.

Select an option

Save xbalaji/bf556e6eafc4f1df00d7c2eb66217a9d to your computer and use it in GitHub Desktop.
# files modified in the last commit
git diff --name-only HEAD HEAD~1
# files modified in the last 5 commits
git diff --name-only HEAD HEAD~5
# files modified in the last 6 commits in a specific directory
git diff --name-only HEAD HEAD~6 | grep modules
# directories modified in the last 6 commits in a specific sub-folder in a specific directory
git diff --name-only HEAD HEAD~6 | grep "modules" | sed -e 's,modules/\([a-z\.0-9\-]\+\).*,\1,g' | sort -u
# files modified
git diff --name-only HEAD HEAD~6 | grep "modules/iam/iam_user" | sed -e 's,modules/iam/iam_user/\([a-z\.0-9\-]\+\).*,\1,g' | sort -u
# git log nice format
git log --date=format:"%Y-%m-%d %H:%M" --pretty=format:"%h %cd %cl %s"
# git log nice format, last 10 commits
git log --date=format:"%Y-%m-%d %H:%M" --pretty=format:"%h %cd %cl %s" -10
# git log merges-only nice format, last 10 commits, commit message in single quoted string
git log --merges --date=format:"%Y-%m-%d %H:%M" --pretty=format:"%h %cd %cl '%s'" -10
# ---------------------------------------
# gh cli
gh auth login --with-token <<<$(head -1 token.txt)
gh auth status
gh repo list xlabsinc
gh config set git_protocol ssh
gh config list
gh repo list xlabsinc
gh repo list xlabsinc -L4500 --json url,updatedAt,visibility | jq -r '.[]|"\(.url) \(.updatedAt)"' | sort | gawk '{printf "%-80s %-20s\n", $1, $2}'
gh repo create --private git@github.com:xlabsinc/<repo-name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment