Reputation: 5207
I have changes on two different machines and they are different to each other. How can I push them to remote origin/master
without having conflicts.
I have this:
Local machine 1: changes A, B
Local machine 2: changes C
How can I push them to remote master and then pull back to both machines so I can have:
Local machine 1: changes A, B, C
Local machine 2: changes A, B, C
Upvotes: 1
Views: 112
Reputation: 41955
If you have remote access to the repo on machine 2, assuming all changes are commited (A, B, and C are existing commits):
on machine 1:
git checkout master && git pull machine2 master
(I'm assuming you have committed to master
on both machines, it sounded like that)git push origin master
on machine 2:
git pull origin master
"Without having conflicts" is not possible if the changes in A, B, and C change the same things. Git does an amazing job at solving conflicts that are solvable, if it does not want to do it for you in that case you have to look into it personally.
Upvotes: 1
Reputation: 717
If the changes hasn't conflicts between them it not exists any problem to get this history.
From machine 1:
git push --set-upstream origin master
And then in machine 2:
git pull --rebase
If you execute git pull without --rebase your will have a merge commit in your history getting this:
Local machine X: changes A, B, Merge-commit, C
Upvotes: 1