1

I have a remote repo which i have changed the last time i cloned it.

The local Repo also change some of the files in my local repo.

What i would like to do is push to origin master, but it says that i need to do a pull first.

Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192
user979587
  • 269
  • 3
  • 14

3 Answers3

2

git does not push the local changes until the server changes has pull and merged with local. so when you going to push the local changes then git prompt to pull (merge) server changes first.

git pull then git push

Dau
  • 8,578
  • 4
  • 23
  • 48
  • again, git pull causes conflicts, how do i resolve, lets say one file has been changed nothing else, you do a pull now what? – user979587 Oct 11 '11 at 10:40
1

About the conflicts you can see on a git pull, see "How do I resolve a conflict after git pull?".
You can solve a merge conflict manually.

If your git opens vim, check your mergetool settings: "My git mergetool open 4(not 3) windows in vimdiff".

Once all conflicts (triggered by the git pull) are resolved, added and committed, then you can git push.
This will add new commits to the remote repo history, making the push result in a fast-foward merge on the remote side.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Type:

git pull

to fetch the remote changes, and merge them with your changes. Resolve any conflicts which arise, and then type

git push

to send your local changes (plus the new merge commits) back upstream.

Rich
  • 15,048
  • 2
  • 66
  • 119