views:

769

answers:

1

In push following errors occured

git.exe push    "origin" master:master

To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'non-fast forward'
section of 'git push --help' for details.
To //oht-fsv1/Source/Git/Test
! [rejected]        master -> master (non-fast forward)

What's wrong?

+3  A: 

From git push:

When an update changes a branch (or more in general, a ref) that used to point at commit A to point at another commit B, it is called a fast-forward update if and only if B is a descendant of A.

In a fast-forward update from A to B, the set of commits that the original commit A built on top of is a subset of the commits the new commit B builds on top of. Hence, it does not lose any history.

In contrast, a non-fast-forward update will lose history.

So this will prevent you to lose history: try a git pull first, resolve potential conflicts, and "git push" the result.

VonC