Skip to content

Instantly share code, notes, and snippets.

@Klemek
Last active April 19, 2021 14:04
Show Gist options
  • Save Klemek/1fea143e9fdf2eb6632fdd2f5bd6c336 to your computer and use it in GitHub Desktop.
Save Klemek/1fea143e9fdf2eb6632fdd2f5bd6c336 to your computer and use it in GitHub Desktop.
Git clone that cd into the cloned repository
#!/bin/bash
git-clone() {
setopt local_options BASH_REMATCH
git clone "$1" && \
[[ $1 =~ (\\w+)(\\.git)?$ ]] && \
cd ${BASH_REMATCH[2]}
}
# git-clone https://github.com/Klemek/miniscord
# or
# git-clone https://github.com/Klemek/miniscord.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment