bash: Refactor _last_committed_files
bash: fix follow_upstream function