Git Workshop
POSTS

Bob: cloning repositories

Bob collaborates with Alice in writing the book. Both of them use the same old PC, as they find easier to focus in a very constrained environment.

Lab

  • Bob is wise enough to know he should not mess with the work of Alice, so he creates his own directory
cd
mkdir bob
cd bob
  • Alice has explained Bob how to use git, so he knows how to get a copy of the database
git clone ../alice/book
ls
  • Bob moves to the retrieved copy of the repository, and investigates how Alice has developed the story until now:
cd book
ls
git log --oneline
  • As the copy of the book has been created using the clone command, the repository keeps a reference to its original address
git remote
Bob wants to check the actual address of the original repo, so he runs the next command
git remote get-███ origin

Solution

git remote get-url origin

  • The clone command doesn’t copy the local configuration of the repo:
cat .git/config
  • Bob updates the configuration of his repo with his name and email
git config user.name Bob
git config user.email bob@example.com

Diagrams

A diagram showing both repos

    Quick access

    1. Introduction
    2. Alice: repo initialization
    3. Alice: first commits
    4. Alice: moving through the timeline
    5. Alice: basic branching
    6. Alice: merging without conflicts
    7. Alice: merging with conflict resolution
    8. Alice: tagging
    9. Bob: cloning repositories
    10. Bob: pushing to origin
    11. Alice: merging and log format
    12. Alice: centralized repository creation
    13. Bob: pulling
    14. Bob: recovering from errors with the reference log
    15. Bob finds the author of a typo
    16. Alice: amending commits
    17. Alice: history simplification
    18. Alice: cherry picking changesets
    © Git Workshop 2023