Skip to content

Instantly share code, notes, and snippets.

@itsjohncs
Created October 8, 2021 02:43
Show Gist options
  • Save itsjohncs/09613632e79c3d72fbc2ee0a4b6c4f87 to your computer and use it in GitHub Desktop.
Save itsjohncs/09613632e79c3d72fbc2ee0a4b6c4f87 to your computer and use it in GitHub Desktop.
Copies the file name of the next modified file in a git repo, or the next untracked file if there's no modified files.
function gn {
printf 'Copied "'
( git ls-files -m; git ls-files -o ) | head -n 1 | tr -d '\n' | tee >(pbcopy)
printf '"\n'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment