merge - Git, merging files manually from an upstream repo to a different repo -


i'm going explain how fetch files 1 repo , manually merge files 1 one using git.

the solution propose based on couple of other posts can find here , here.

you may find these posts helpful:

git -p options

list files git commit

hope helps saving time.

1- go folder containing code branch x of repo r1

2- add repo r2 upstream running:

git remote add upstream

3- fetch (do not pull) branch y of repo r2:

git fetch upstream y

note: if have same branch names (in case "y") in r1 , r2 git confused @ stage , have disambiguate branch name git proceed.

4- if don't want mistakenly push changes upstream use dummy url pushurl:

git config remote.upstream.pushurl "some random text"

5- figure out files have changed in last commit in y branch of r2

running following command:

git rev-parse head

git diff-tree --no-commit-id --name-only -r

note: can run above commands either going folder containing branch y of r2 or checking out y r2 in same folder

6- merging changed files run:

git checkout -p upstream/y path/to/changed/file/filename can choose "a" stash local changes , merging changes upstream

7- adding new files run (do not use -p param): git checkout upstream/y path/to/changed/file/filename

hope helps.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -