I am developing code with another programmer. Since at the beginning I had to add new modules without modifying the existing code, I copied the source code of the other programmer and I started to develop mine. Since I always work with git, I set up a git repository and performed some commits.
Now the other programmer modified part of its code and I also had to modified some of the parts I was not supposed to modify at the beginning. Thus the situation is now the following:
We wolud like to merge our modifications and start using git. I tried to create a bare repo in a shared folder using his code as starting point (i.e. git --bare
in his previously untracked folder). Then I added this repo to my remote command using git remote add origin /path/to/local/bare/repo
. Then I tried to push my changes (which can contain conflicts) with push origin master
, but I geot the following message:
Everything up-to-date
However if I look at my source code and at the one in the bare repo, my changes are not present.
How can I marge two codes, one without git and the other tracked with git, into the same bare repository in order to start a shared version control?
Step 1: Assuming that your friend did git init --bare
to create a bare repo. Copy your friend's changes here. This directory acts a shared central store here on.
Step 2: Once you are sure if step 1 is complete do the following once you are done with your local commits:
1. git pull origin <branch> --> At this point you must see if there are new files/changes
2. git merge <branch> --> At this point you must see conflicts and modifications
3. git push origin <branch>