cd(1posix) %24%28mktemp -d%29%3B git init a%3B %28cd a%3B touch a%3B git add a%3B git commit -m a%29%3B git clone a b%3B %28cd b%3B git checkout -b ignore-this%29%3B git clone a c%3B %28cd c%3B git checkout -b ignore-this%29%3B %28cd a%3B echo a %3E%3E a%3B git add a%3B git commit -m A%3B git checkout -b ignore-this%3B git fetch ..%2Fb%3B git push ..%2Fb main%29%3B for a in *%3B do %28cd %24a%3B echo %24a%3B git log main --oneline%29%3B done%3B %28cd c%3B git fetch ..%2Fb%3B git push ..%2Fb main%3B echo %27well that did not work -- try forcing it%21%27%3B git push ..%2Fb main --force%29%3B for a in *%3B do %28cd %24a%3B echo %24a%3B git log main --oneline%29%3B done
change the working directory
directory
       An absolute or relative pathname of the directory that shall become the new working directory. The
       interpretation of a relative pathname by cd depends on the  -L  option  and  the  CDPATH  and  PWD
       environment variables. If directory is an empty string, the results are unspecified.

-      When a hyphen is used as the operand, this shall be equivalent to the command:

       cd "$OLDPWD" && pwd

which changes to the previous working directory and then writes its name.
source manpages: cd