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:
- Replace the local repository code with git3 (now tree is project1->git1)
- compare it with head (which is project1->local1)
- 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.
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.