List git repositories with unpushed changes

I’m reinstalling my OS. I have thousands of repos on my computer. I have a feeling that I’ve made a few changes in some repos while hacking around that are not committed and/or pushed.

From a bash shell on my Debian PC, what’s the best way to find a list of changes that have not yet been committed/pushed to their remotes, and decide whether or not I want to keep the changes?

  • modifying working directory and staging area temporarily in git pre-commit hook
  • CLOSED - Just install git but the console don't recognise the git commands
  • How to determine last merged branch in git?
  • Git Bash Slow on Windows 10
  • Cannot generate a new CSR in git bash
  • git error: “fatal: not a valid revision”
  • Could not create directory '/home/username/.ssh'
  • Alias for submodules
  • How to set aliasses in the Git Bash for Windows?
  • -bash: hooks/post-receive: Permission denied
  • Problems using git diff to create file list for deploy
  • Git server's host key not cached in registry - GitHub.com
  • One Solution collect form web for “List git repositories with unpushed changes”

    I’m assuming finding each repo and running git status in each repo is sufficient for your needs. In which case the following might be a starting point for you:

    find / -name "*.git" -type d -print0 | xargs -0 -L 1 -i% bash -c "cd %/..; pwd; git status -s -uno"
    

    find traverses your filesystem, starting at / (you may want to restrict that to perhaps ~), searching for .git diretories. The output (null-delimited to handle funny filenames) is piped to xargs, which cds to each repo, prints the pwd, and short-form git-status, without listing untracked files.

    Git Baby is a git and github fan, let's start git clone.