I am currently using git for a project that has two participants (me and my friend). SO I did the following :
I created a repository on a machine that is always accessible by any machine on our local network.
We both cloned this repository into our respective local machines creating local repositories.
Now suppose at one point of time (wherein all three repository copies are in the exact same stage), I fork a branch and start some development in that branch. I push those changes to the remote and I see that a new branch has automatically been created in the remote.
On the other machine I pull that branch into a new local branch of the same name so they are all in the same state again.
Now when I am done with this fork branch, and I want it merged with the master, I simply did a checkout to master and did a git merge my_branch. Now how do I make this change reflect in the global repository and the other local repository ? Will I have to issue merge commands there too ? Or is there some way to push and pull so that merges are automatically synced?
What IS the git philosophy ? Should all local repositories and the global repository be exactly in sync commit by commit so that the trees everywhere are exactly same ? Or can individual trees be different and whatever branches are needed be pulled from the remote accordingly ?
(I have learned GIT by searching commands for whatever I need done, however I am very confused by how it is supposed to work)
The remote repository I created was a bare repository
After you’ve merged into master, use
git pushto push that merge up to your origin repository, just like you would with any other commit. Your friend will need togit pullto get your changes, but so long as there’s nothing new in the origin, and your friend hasn’t done any changes in master in their own copy, no additional merges will have to be run.The repositories won’t always be exactly in sync; that’s one of the key differentiators of a distributed VCS.