4 ms·
A trick I commonly use is: cd - Which goes back to the previous directly I was just on. They have the same thing for git as well: git checkout - it'
by jastanton 10y ago
A trick I commonly use is:
cd -
Which goes back to the previous directly I was just on. They have the same thing for git as well:
git checkout -
it's quite handy for switching back and forth between branches or directories!
- gbersac 10y agoThanks for gi checkout -. I am currently using git checkout @{-1} which does the same thing...in a more verbose way.
- epidemian 10y agoI recently learned that this trick also works with merge. `git merge -` merges the last branch you were on onto the current one. So far i've found it very useful :)
- Fnoord 10y agoI was using $OLDPWD and your solution is much shorter, cheers. Both also work in my shell, Fish. Perhaps obvious, but it is also possible to use cd - twice to get back to orig.