When I'm coding, I usually have 2 terminal tabs open in VSCode. The tab on the left is used for git commands. The tab on the right always has git log --all --graph --decorate --oneline showing me all the branches and commits.

I'm trying to make it so that the tab on the right reruns the git log command as soon as I checkout branches, checkout new branches, commit, push, pull...

I tried this:

# watchgit.sh
inotifywait -m .git/refs -m .git/HEAD |
    while read dir action file; do
        git log

but it doesn't refresh. I also don't mind if I get a few extra refreshes here and there.

Would appreciate some help.

Thanks! My VSCode terminal setup

  • Not really interested in that but I guess I would have a look if I knew the feature you were talking about. The issue also is that this history feature that you're talking about would show up in the VSCode panels themselves. I prefer the terminal windows because I can switch between coding and a full screen display of my 2 terminals side by side with a shortcut; it's really that easy. Whereas the history feature that you're talking about will (likely) take up precious real estate in the VSCode panels themselves, requiring me to do some shifting/resizing. But I'm open to having a look I guess.
    – Bassam
    Commented Nov 5, 2021 at 15:32

1 Answer 1


Take look to the bottom right there is the (END) this comes from the pager used by git.

There --no-pager to avoid this issue

Then do while to react to each event around inotifywait:

while inotifywait .git/refs .git/HEAD ; do                                                             
 git --no-pager log --decorate=short --pretty=oneline

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .