Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Git require me to pull before I push?

I keep getting an error saying: rejected master-> master (fetch first), failed to push some refs.... because remote contains work you do not have locally.

I just want git to overwrite the files currently in the repository with the new uploads so I've been trying to use git push -u origin master, but this error keeps popping up. I'm brand new to git/github. Why is this happening?

I've tried to merge the existing files in the repo with the files on my desktop, but I keep getting merge conflicts. Not sure how to deal with these.

like image 711
Zack Avatar asked Jan 19 '14 22:01

Zack


1 Answers

git telling you that you must first:

git fetch

and later

git add /commit /push

fetch is similar to pull but, pull merge the data in files in your local branch , fetch update only the branch structure and id..

if fetch does not work, it means that someone else committed to changing, and now your version must be upgraded before being released

like image 127
archetipo Avatar answered Sep 22 '22 05:09

archetipo