• NostraDavid@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    4 months ago

    Same for cd -. Nice if you want to go to /etc/blah, and then back to where you were.

    You can also use pushd and popd which will push and pop directories from a stack, if you need to do something more complex.

    Also, if you want to switch faster between branches, slap this in your ~/.gitconfig under [alias]:

    co = !git checkout $(git for-each-ref refs/heads/ --format='%(refname:short)' | fzf)

    Presuming you’ve got fzf installed, you can now git co (co = checkout) to get a menu with fuzzy find capabilities to switch between branches. Nice if branch names are long/similar/only-different-at-the-end.

    fzf is dope.