DEV Community

Cover image for Sync your fork from the terminal
Sidharth Mohanty
Sidharth Mohanty

Posted on • Edited on

Sync your fork from the terminal

As a collaborator on GitHub projects who heavily relies on forks, I found myself performing a repetitive task every morning: syncing my forks with the parent repositories to stay up-to-date. This manual 3-step process of navigating GitHub, checking for updates, and syncing felt like an everyday chore.

Being a developer, I decided to automate this!

Introducing syncb, a simple script that streamlines your workflow with a single command. With syncb, you can effortlessly sync both public and private forks, saving you valuable time and frustration.

syncb

Getting Started

Install syncb globally using npm:

npm i -g syncb
Enter fullscreen mode Exit fullscreen mode

Run syncb in your terminal.

That's it! syncb seamlessly syncs your repository with the latest commits from the parent repository.

Using Private Forks

Initially, I encountered authorization issues (401 errors) when syncing private forks. To overcome this, you can securely store a GitHub Personal Access Token (PAT) with repo access in your environment variable as GITHUB_TOKEN (e.g., .zshrc). syncb will automatically leverage this token for private repo syncing.

Share and Contribute!

Did syncb make your life easier? Share it with a star ⭐ on the repository! Additionally, I'd love to hear your preferred fork syncing methods – perhaps you have a more efficient approach? Feel free to contribute to the project as well!

Connect with me!

Visit sidharthmohanty.com to stay connected.

Top comments (2)

Collapse
 
jeffreythecoder profile image
Jeffrey Yu

@sidmohanty11 Very cool project! I typically use the GitHub web UI for syncing, and then pull the changes to my local fork. It's great to see a neat way for syncing locally

Collapse
 
sidmohanty11 profile image
Sidharth Mohanty

Thanks a lot @jeffreythecoder!