I'm a huge fan of Vagrant and have been using it pretty extensively lately. In particular, I'm using it to develop, test and debug a number of Puppet modules. Obviously I keep these modules under version control, for which I strongly prefer Git. The problem I was coming across was that, in order to run git commands, I have to be in the appropriate module's sub-directory, but to run 'vagrant provision' I needed to be in the root of the vagrant project.
While hardly the end of the world to switch directories repeatedly, or keep a
screen available, within which to run 'vagrant provision', I was starting to find it annoying. I prefer something a little quicker and more straight-forward. So, when a colleague recently introduced me to
popd, a simpler solution presented itself. I wrote a little bash script
alias vpro="pushd $PROJECT_PATH && vagrant provision && popd"
I run this script in the root of my vagrant project, where I'd normally have to be to run 'vagrant provision'. It sets up an alias, "vpro", which I can call from then on from anywhere. I could just as easily have used "cd $PROJECT_PATH" and "cd -", but I was curious about pushd and popd, and so used those instead.