Skip to content

Instantly share code, notes, and snippets.

@ryukinix
Last active August 2, 2017 04:58
Show Gist options
  • Save ryukinix/a9a57500bb7637fb96e8 to your computer and use it in GitHub Desktop.
Save ryukinix/a9a57500bb7637fb96e8 to your computer and use it in GitHub Desktop.
A newbie script to fetch commits from a external remote
#!/bin/bash
#
# This script syncronize a repository forked.
#
# Deliright @ Manoel Vilela
#
# The original source: https://help.github.com/articles/syncing-a-fork/
#
# Warning: THIS A UNTESTED SCRIPT! IF YOU HAVE PROBLEMS, TRY READ THE STDOUT!
# input the original repository git-url
url="[email protected]:ryukinix/lists-in-c.git" # you may wants change the variable
# define a new remote input on git local
git remote add upstream $url
# fetch all up-commits on upstream at local repository
git fetch upstream
# checkout the unstaged changed for preserv the integrity of respository
git checkout master
# merge with the master branch
git merge upstream/master
# push to the remote repository
git push master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment