3 ms·
Likewise, why doesn't git clone automatically cd into the repo?
by marcuskaz 1y ago
Likewise, why doesn't git clone automatically cd into the repo?
- andriamanitra 1y agoA subprocess (git) can't modify the working directory of the parent process (the shell). This is a common annoyance with file managers like yazi and ranger as well—you need an extra (usually manual!) installation step to add a shell integration for whichever shell you're using so the shell itself can change directory. The best solution for automatically cd'ing into the repo is to wrap git clone in a shell function or alias. Unfortunately I don't think there's any way to make git clone print the path a repository was cloned to, so I had to do some hacky string processing that tries to handle the most common usage (ignore the "gh:" in the URL regex, my git config just expands it to "git@github.com:"): https://github.com/Andriamanitra/dotfiles/blob/d1aecb8c37f09bba0613f75056d379c2b055cca8/fish/.config/fish/functions/clo.fish https://github.com/Andriamanitra/dotfiles/blob/d1aecb8c37f09...