Command | New files | Changed files | Deleted files |
snap no: 1 | |||
Alice adds a file. Note the typo (noe instead of one).
snap no: 2 | |||
snap no: 3 | |||
snap no: 4 | |||
Bob clones Alice's repository
snap no: 1 | .git/HEAD .git/index .git/config .git/packed-refs .git/description .git/refs/heads/master .git/refs/remotes/origin/HEAD .git/info/exclude .git/hooks/pre-rebase.sample .git/hooks/pre-push.sample .git/hooks/applypatch-msg.sample .git/hooks/pre-commit.sample .git/hooks/post-update.sample .git/hooks/commit-msg.sample .git/hooks/pre-applypatch.sample .git/hooks/update.sample .git/hooks/prepare-commit-msg.sample .git/logs/HEAD .git/logs/refs/heads/master .git/logs/refs/remotes/origin/HEAD .git/objects/ae/53cf2363580a5222ab057cb849e160fa5d9d20 [tree].git/objects/cb/f36f188e2f1999a8fc210780d2ece9543b5b01 [blob].git/objects/54/925a33cabe9e11addc822c11d96c1efc8cce2a [commit]numbers.txt | ||
Comparing Alice's and Bob's repositories:
snap no: 2 | |||
What does .git/refs/origin/HEAD contain?
snap no: 3 | |||
It contains
snap no: 4 | |||
Bob fixes the typo ...
snap no: 5 | |||
... and commits the changes.
snap no: 6 | .git/COMMIT_EDITMSG .git/objects/4c/b29ea38f70d7c61b2a3a25b02e3bdf44905402 [blob].git/objects/7a/1bbd139d33412f832fa3b7057e6b1bb54aec79 [tree].git/objects/ae/b44f783064140a4e09f9c0691509dfb31ddccb [commit] | ||
In the mean time, Alice adds another number to numbers.txt ...
snap no: 5 | |||
... and commits the change.
snap no: 6 | .git/objects/3d/05481a9daeae7070fe68dd37247ff18eb202b3 [commit].git/objects/65/0d89fb0fe67b862fb32d66920323de21e3c0e0 [tree].git/objects/c6/c8539f78075e25d92b1702af902deef97ef6b2 [blob] | ||
numbers.txt now contains four numbers, still with the typo.
snap no: 7 | |||
Alice defines a remote repository to make it easier to work with Bob's repository.
snap no: 8 | .git/config | ||
Using the fetch command, Alice can peek at what Bob changed, without merging it
snap no: 9 | .git/FETCH_HEAD .git/logs/refs/remotes/bob/master .git/objects/4c/b29ea38f70d7c61b2a3a25b02e3bdf44905402 [blob].git/objects/7a/1bbd139d33412f832fa3b7057e6b1bb54aec79 [tree].git/objects/ae/b44f783064140a4e09f9c0691509dfb31ddccb [commit].git/refs/remotes/bob/master | ||
First, Alice shows the log without dots, so every commit is shown.
snap no: 10 | |||
Then, she uses three dots to show the changes since Bob has cloned Alice's reposiotory.
snap no: 11 | |||
Finally, she uses two dots, which shows only what Bob has commited. She also uses the -p flag for more information on the commits.
snap no: 12 | |||
Alice likes Bob's change and merges them. Instead of using git fetch followed by git merge, she could also have used git pull which would have executed those two operations in one go.
snap no: 13 | .git/ORIG_HEAD .git/objects/9f/02fc71595d75fcce7d0d0055e216f17258f141 [commit].git/objects/a3/715c9d73d9ceccc57b64fbf6a5e510dc47a61a [tree].git/objects/f3/84549cbeb481e437091320de6d1f2e15e11b4a [blob] | ||
snap no: 14 | |||
The typo is fixed.
snap no: 15 | |||
Bob wants to fetch Alice's latest changes.
snap no: 7 | .git/FETCH_HEAD .git/ORIG_HEAD .git/logs/refs/remotes/origin/master .git/objects/3d/05481a9daeae7070fe68dd37247ff18eb202b3 [commit].git/objects/65/0d89fb0fe67b862fb32d66920323de21e3c0e0 [tree].git/objects/9f/02fc71595d75fcce7d0d0055e216f17258f141 [commit].git/objects/a3/715c9d73d9ceccc57b64fbf6a5e510dc47a61a [tree].git/objects/c6/c8539f78075e25d92b1702af902deef97ef6b2 [blob].git/objects/f3/84549cbeb481e437091320de6d1f2e15e11b4a [blob].git/refs/remotes/origin/master | ||
In the prior pull command, git »knew« what repository to pull it from since it stored it in »remote.origin.url« which was set in git clone.
snap no: 8 | |||
Finally, a demonstration that Bob has received the added number »four« from Alice.
snap no: 9 |