What happens when Dan changes the text to "aB" and "John" to "abc"?

Imagine a very simple text document (text.txt) with only the contents of the letter "ab". This file has been registered in the canonical (remote) repository. Two people have a local closure of this repository and therefore this file and start editing it. Dan changes the contents to "aB" (note capital B), and John edits his version to "abc". Dan makes a commit and puts it in the canonical repository. John does a local commit a bit later and pushes the changes to the remote. What happens (message) when John pushes his repository?

+3
source share
3 answers

It depends on which flags John uses when he pushes.

By default, it will not be able to click because the remote branch (Dan commit) is not an ancestor of John's revision.

With -for, --forcehe will simply overwrite Dan with John, effectively canceling Dan, if the server is configured to allow force clicks, at least. Many git servers will simply refuse to do this.

, "" , . , , , - . git pull, . , . , (, "aBc", git add text.txt; git commit, git), " ", . .

+3

. John push , , , .

, , , , . , .

+1

There will be a merger conflict

0
source

Source: https://habr.com/ru/post/1751157/


All Articles