git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What happens if someone modifies repository without me knowing?

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Sep 26, 2010, 19:16 UTC
Message-ID
<AANLkTimUCGcM+OXqBOfHmGCaBamG27fjjz098-7GZ1G7@mail.gmail.com>
In-Reply-To
<i7o5rc$t3$1@dough.gmane.org>
Heya,
On Sun, Sep 26, 2010 at 21:07, Manuel Reimer <Manuel.Spam@nurfuerspam.de> wrote:
> How will GIT tell me about this hidden change? Will a "git pull" just bring
> this change into my working copy, whithout telling me about the change?

It will tell you it did a "forced update", assuming the other side has been set as your upstream. If you do a pull (rather than a fetch) it will try to apply the changes right away too.

Demonstration:
sverre@laptop-sverre:~/code
$ git init test
Initialized empty Git repository in /home/sverre/code/test/.git/
sverre@laptop-sverre:~/code
$ cd test/
sverre@laptop-sverre:~/code/test
$ echo "content" > foo
sverre@laptop-sverre:~/code/test
$ git add foo
sverre@laptop-sverre:~/code/test
$ git commit -m "Initial"
[master (root-commit) 9d48240] Initial
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 foo
sverre@laptop-sverre:~/code/test
$ echo "second line" >> foo
sverre@laptop-sverre:~/code/test
$ git commit -am "Proper second modification"
[master 8367122] Proper second modification
 1 files changed, 1 insertions(+), 0 deletions(-)
sverre@laptop-sverre:~/code/test
$ cd ..
sverre@laptop-sverre:~/code
$ git clone test/ foo
Cloning into foo...
done.
sverre@laptop-sverre:~/code
$ cd test/
sverre@laptop-sverre:~/code/test
$ echo "and a third" >> content
sverre@laptop-sverre:~/code/test
$ git commit --amend -am "Tampered second modification"
[master 87d8e8a] Tampered second modification
 1 files changed, 1 insertions(+), 0 deletions(-)
sverre@laptop-sverre:~/code/test
$ cd ../foo/
sverre@laptop-sverre:~/code/foo
$ git pull
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /home/sverre/code/test
 + 8367122...87d8e8a master     -> origin/master  (forced update)
Merge made by recursive.
-- 
Cheers,

Sverre Rabbelier
Previous: Manuel ReimerNext: Ilari Liusvaara
Message 2 of 3 in “What happens if someone modifies repository without me knowing?”
  1. Manuel ReimerSep 26, 2010
  2. Sverre RabbelierSep 26, 2010
  3. Ilari LiusvaaraSep 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.