Skip to content

Instantly share code, notes, and snippets.

@harshraj22
Last active March 21, 2020 07:00
Show Gist options
  • Save harshraj22/2b703f8a077a5ba95a822fe898b16558 to your computer and use it in GitHub Desktop.
Save harshraj22/2b703f8a077a5ba95a822fe898b16558 to your computer and use it in GitHub Desktop.
A file depicting how to update your repo from other repo

git add upstream https://github.com/harshraj22/Practice_plan.git
(add upstream branch, as you created local git repo now, it isn't expected to have an upstream)

git fetch upstream
(fetch all changes from upstream to local repo)

git rebase upstream/master
(rebase your current branch from master of upstream, you can also use git merge --allow-unrelated-histories upstream/master if you prefer merge commit)

git remote rm origin
(remove reference to origin, if exists, can be verified using git remote -vv)

git remote add origin https://github.com/harshraj22/Practice_plan.git
(add remote repo as origin, this is where we will push our commits)

git push origin master
(if everything works well, push your second one here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment