Skip to content

Instantly share code, notes, and snippets.

@tamakiii
Last active February 7, 2019 08:50
Show Gist options
  • Save tamakiii/635ebafacf6eaa8cd865cab2695fb52e to your computer and use it in GitHub Desktop.
Save tamakiii/635ebafacf6eaa8cd865cab2695fb52e to your computer and use it in GitHub Desktop.
# reset submodule's diffs like `modified: .fzf (new commits)`
# @link https://stackoverflow.com/questions/10906554/how-do-i-revert-my-changes-to-a-git-submodule
git submodule update --init
# Get current branch
# @link https://man.openbsd.org/sed.1#SED_REGULAR_EXPRESSIONS
# > One special feature of sed regular expressions is that they can default to the last regular expression used.
# > If a regular expression is empty, i.e., just the delimiter characters are specified, the last regular expression
# > encountered is used instead. The last regular expression is defined as the last regular expression used as part of
# > an address or substitute command, and at run-time, not compile-time. For example, the command “/abc/s//XXX/” will
# > substitute “XXX” for the pattern “abc”.
git branch | sed -n 's/\* //p'
git commit -m $(git branch | sed -n '/\* /s///p')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment