I'm new to git, I know how to push changes when you're single on a project, but right now I'm in situation with three developers on one project. So I have a project which was downloaded as zip file directly from repository (not cloned), then I made a lot of changes and my colleague made some changes too at the same time and he pushed them. Now I need to pull his changes, merge them and push, but I have problems in the end, when I push files (successfully), all files update even that I didn't touch and change.
So here is my steps:
git init
then I manage remote repository:
git remote add origin <remote url>
and can check it:
git remote -v
and receive:
> origin <remote url> (fetch)
> origin <remote url> (push)
then I add files and commit changes:
git add .
git commit -m "Test"
then I'm trying to pull changes from repository:
git pull origin master
and get a message fatal: refusing to merge unrelated histories and type:
git pull origin master --allow-unrelated-histories
Then I have a message Please move or remove them before you merge. and I delete them and pull again:
git clean -f -d -x
git pull origin master
And get some merge conflicts, I fix them manually and again add files and commit:
git add .
git commit -m "Merge conflicts Test"
Finally I push files:
git push origin master
And what I see is that all files are updated with two variants(15 minutes ago and 10 minutes ago): push result of two commits
So first one (15min) on first commit and (10min) on second, but why first commit updates every file, does it happens because I didn't clone repository, right? If yes, how can I fix it?