It is a bit of embarrassing but I spent 10 years in my field without knowing the
cd -
,git checkout/merge -
shortcut.
The -
references the last folder/branch you accessed. So this is a thing:
$ pwd
/Users/kait/Downloads
$ cd test
$ pwd
/Users/kait/Downloads/test
$ cd -
$ pwd
/Users/kait/Downloads
Probably the biggest revelation I ever had once a colleague of mine told me.
Top comments (3)
If you like that, check out popd and pushd
That one I actually knew before :) But yeah, especially in scripts pushd and popd are awesome.
Ah yes, the
-
shortcut, the "back button" of bash! 😄