GithubHelp home page GithubHelp logo

update-all-repos's Introduction

Keep all your local repos and workspaces synced with one command



Automate the chore of keeping your workspace up to date.

Highlights

  • Update all repositories in your workspace/s

Install

For this script to work, you need to have bash, git and a terminal of your choice installed.

API

None, but the script itself is highly hackable and i've included a bunch of bash prompt colors for easy customizing.

Installation

# Clone repo
git clone https://github.com/2lach/update-all-repos.git
# go into the folder
cd update-all-repos; 

# and add this script to your path
# it can be done with:

cp get-all-updates.sh ~/

# add it to your bashrc
printf '# Update all repositories in your workspace(s) \n
git-update-all(){
bash ~/get-all-updates.sh $PWD
}' >> ./.bashrc

You can also add it to your bin folder (requires sudo)

sudo chmod +x get-all-updates.sh;
cp get-all-updates.sh ~/usr/local/bin/get-all-updates

Now you can update all your repositories, in all your workspaces by running: get-all-updates so you never again have to enter them one-by-one and update them like a savage ;).

  • The script is tested and works works with bash, zsh, ksh and pretty much any shell.

The logic step by step

  1. first the script checks if there is a .git folder.
  2. If there is a .git folder, it will check if the the current branch is master/main or develop.
  3. If these are true meaning both git repo exists and the branch is master, main or develop the script will run git fetch and git pull
  4. After the pull is done, it will exit the folder and repeat the process on the next folder in your current path.
  • If any of the steps 1-3 is false it will exit the the folder and continue with the next.

Extension, check for commited secrets

A secrets check which includes a scan after git update of repository is completed The scan is run with the free and opensource tool gitleaks

Essentially if gitleaks is installed a 4:th step is included after step 3) when the script will run git fetch and git pull

If gitleaks is installed, a file will be created in the repository with the name ´gitleaks_report_foldername_branch.txt` containing the results if any secrets or sensitive infomation is present in the repository. 5) After the scan is done, the script will exit the folder and repeat the process on the next folder in your current path.

if gitleaks is not installed it will do as before e.g update repositories and move on to the next, that's it.

Demo
get-all-updates gitleaks-demo-fast-cropped

Maintainers

License

MIT

update-all-repos's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.