シェルスクリプトでもできなくはないですが、私の知る限りでは対話式Pythonが最速です。

シェルスクリプトでもできなくはないですが、私の知る限りでは対話式Pythonが最速です。
ソースコードの履歴はVSCodeのGit拡張機能 Git Graphで管理しています。
Git Graphの難点はデフォルトの日付が英語表記になっているところです。これを標準的な表記にするには、拡張機能設定のDate:FormatをISOにします。
#define DATA_DIR "/dir" // 変更後の作業ディレクトリ
#define PATH_SIZE 512
#include <iostream>
#include <unistd.h>
using std::cout; using std::endl;
// 変更前の作業ディレクトリ確認
char tmp[256];
getcwd(tmp, 256);
cout << "Current working directory: " << tmp << endl;
// 作業ディレクトリ変更
chdir(DATA_DIR);
// 変更後の作業ディレクトリ確認
getcwd(tmp, 256);
cout << "Current working directory: " << tmp << endl;