Last active
August 2, 2017 04:58
-
-
Save ryukinix/a9a57500bb7637fb96e8 to your computer and use it in GitHub Desktop.
A newbie script to fetch commits from a external remote
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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