Git Workshop
POSTS

Alice: merging and log format

Our preferred writer is back, and having read Bob’s message she decides to merge his work.

Lab

  • First, she jumps into her workspace
cd
cd alice/book
  • And checks that everything is just like she left it:
git status
ls
  • But Alice can confirm there is a new branch in her repo
git branch
  • So this should be an easy one: Alice merges the changes from Bob into her main branch
git merge wip-chapter-02
  • Ok, there it is the promised new chapter
ls
Alice has her preferred way to take a quick look at the repo history, and this looks like a good moment to put it in play. She uses the `pretty` option to set a particular format for the log messages
git log \
  --pretty=██████:"%h%x09%Cgreen%an%Creset%x09%s (%ah) %Cred%d%Creset" \
  --graph

Solution

git log \
  --pretty=format:"%h%x09%Cgreen%an%Creset%x09%s (%ah) %Cred%d%Creset" \
  --graph

  • Alice doesn’t want to get her repo polluted with many branches created by Bob, so she deletes the new one
git branch -d wip-chapter-02
git branch
  • Well, time to drink some tea. Alice exits her repo
cd ../../

    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