gsagrawal
gsagrawal

Reputation: 3020

git Merging same directory of two different repositories

I am using one open source project which is hosted on git-hub.

I am also making lots of changes in this project at my end and keeping this in my another local repository.

So when i need to fetch new changes from git-hub I am facing issues in merging both (changes of my local repository and the git-hub)

For example : project 1 -> local1 also from github : project 1 -> git-1 **these changes are on same directory. Currently i am merging these two in below steps:

  1. Replace the local repository code with git3 (now tree is project1->git1)
  2. compare it with head (which is project1->local1)
  3. Update the local1 changes (head is now project1->local1->git1-local merge)

but in case of any new update from git-hub (say now tree is project1->git1->git-2) and new update in my local (project1->local1->local2) .if i now go for merging of these two ,i have to again repeat (again add the changes of local1) . i am fine if somehow i can only add the changes of local2.

I hope i am clear in what i am trying to say.

Upvotes: 1

Views: 192

Answers (1)

CharlesB
CharlesB

Reputation: 90316

Doing things manually is really difficult, you're making the task complex and error-prone.

Git can help you with this, by designating states of remote repositories with referencs, like origin/branch, origin/master, etc.

See commands such as git merge origin/branch, git chekout branch, and stuff like this. You don't need different working copies, nor manually moving stuff between directories. Git handles it for you when switching different branches.

Upvotes: 1

Related Questions