Home > database >  How to fetch latest branch from github and override existing codes?
How to fetch latest branch from github and override existing codes?

Time:06-29

I am working on a project for the last couple of days. I did work on both my home computer as well as my office computer in my office.

I worked on my home computer 2 days ago and it has branch "002" codes, but I did continue work on this project and today I pushed those codes in branch "005" in the same git repo from my office computer.

How can I fetch the branch "005" from GitHub in the same folder on my home computer and override old codes "002 branch codes" as well?

Thank you.

CodePudding user response:

From you home computer,

  1. checkout branch "005" from GitHub to create a local branch "005" on your home computer.
  2. change to the existing branch "002"
  3. Merge branch "005" into "002"

CodePudding user response:

Just completing the answer from nbstrat:

From your home computer:

move to the most updated branch that has all the changes

git checkout 005

Get most recent version from remote repo

git pull

Merge the old branch you had in your home computer

git merge 002

Should be good to go.

  • Related