Advertisement
crispud

Github repository fork automatic update

Feb 3rd, 2023
1,242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.47 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. # Name of the GitHub user whose forks you want to update
  4. user=your-github-username
  5.  
  6. # Get a list of all repository names for the user
  7. repos=$(curl -s https://api.github.com/users/$user/repos?per_page=1000 | jq -r '.[].name')
  8.  
  9. # Loop through the repository names and update each fork
  10. for repo in $repos; do
  11.   echo Updating $repo...
  12.   cd $repo
  13.   git checkout master
  14.   git fetch upstream
  15.   git rebase upstream/master
  16.   git push -f origin master
  17.   cd ..
  18. done
  19.  
Tags: github
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement