<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Git Workshop</title><link>https://mcatrisse.github.io/git-workshop-lab/</link><description>Recent content on Git Workshop</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://mcatrisse.github.io/git-workshop-lab/index.xml" rel="self" type="application/rss+xml"/><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/000-introduction/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/000-introduction/</guid><description>Introduction Alice and Bob are writers who are collaborating on a new book. They&amp;rsquo;ve decided to use Git as their tool for collaborative edition, and a very ancient computer with a model M keyboard attached to it.
To get started, they&amp;rsquo;ll need to set up a Git repository for the book. This will allow them to track changes to the book over time, collaborate on the book together, and easily merge their changes into a single version of the book.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/010-repo-initialization/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/010-repo-initialization/</guid><description>Alice: repo initialization Our writer switches on the old computer with the intention of setting up everything to write the story in collaboration with Bob. The first step will be to initialize the git database.
Lab Alice is going to create his own workspace: mkdir -p alice/book cd alice/book After doing it, she starts writing the story cat &amp;lt;&amp;lt; EOF &amp;gt; chapter-01.md # Tim and the waves Being a young boy, Tim had always been fascinated with the ocean.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/020-first-commits/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/020-first-commits/</guid><description>Alice: first commits Now that Alice has a proper git repository in place, she can take advantage of it to start developing her novel.
Lab Our author wants to take a look at the current state of her repo: git status Time to add the current version of the chapter to the git index (aka staging zone): git add chapter-01.md The output of the add command was not very verbose, so Alice looks again at the state of the repo git status Now that everything seems on its place, she will put the current text of the chapter in the repository by creating her first commit: git commit -m &amp;#34;Initial draft of the first chapter&amp;#34; She wants to check that everything is being tracked as expected.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/030-moving-through-the-timeline/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/030-moving-through-the-timeline/</guid><description>Alice: moving through the timeline Note: this section of the course requires root access to install a tool. If it is not possible for you to get elevated privileges, just check if delta is already present in the system.
Lab Alice decides that a more fancy diff tool would provide better feedback, so she configures the delta diff tool: wget -O delta.tar.gz https://github.com/dandavison/delta/releases/download/0.19.2/delta-0.19.2-x86_64-unknown-linux-musl.tar.gz tar -xvf delta.tar.gz mkdir -p $HOME/.local/bin cp delta-0.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/040-basic-branching/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/040-basic-branching/</guid><description>Alice: basic branching Reading the chapter again, Alice understands she has to enhance the vocabulary of the descriptions. But she also wants to keep developing the story, separating both tasks.
Lab so she creates a *branch* to undertake that task. git status git branch # show branches git b█████ vocabulary-chapter-01 # create new branch git status git branch # show branches git c███████ vocabulary-chapter-01 # move HEAD to the new branch git status git branch # show branches Solution git status git branch git branch vocabulary-chapter-01 git status git branch git checkout vocabulary-chapter-01 git status git branch Our artist wants to check where HEAD is pointing to: cat .</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/050-merging-without-conflicts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/050-merging-without-conflicts/</guid><description>Alice: merging without conflicts Alice knows that branches must be integrated often to avoid problems, so she will merge the vocabulary branch with the main one.
Lab First, she checks that she is in the main branch git branch Now, she checks the differences between both branches git diff main vocabulary-chapter-01 There are some long lines, so maybe it would be better to get the difference without using delta. To deactivate it, Alice just pipes the output of git to another command git diff main vocabulary-chapter-01 | cat - # diff without using delta This is the moment to create a new commit with the content of both versions merged git merge vocabulary-chapter-01 -m &amp;#34;Merged vocabulary&amp;#34; Now the main branch contains all the words, plus the stranger&amp;rsquo;s profession: cat chapter-01.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/060-merging-with-conflict-resolution/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/060-merging-with-conflict-resolution/</guid><description>Alice: merging with conflict resolution In this chapter, Alice will show us how to properly manage more sophisticated merge operations.
Lab Alice will keep working hard in increasing the tension of the story in the main branch, expanding one of the sentences to provide a more immersive description: git status sed -i &amp;#39;s/afloat/afloat, fighting the waves/&amp;#39; chapter-01.md git diff chapter-01.md git add chapter-01.md git commit -m &amp;#34;Enhanced paragraph&amp;#34; At the same time, she also keeps pushing for a richer use of language, so she moves HEAD to the vocabulary branch git checkout vocabulary-chapter-01 Let&amp;rsquo;s confirm that there is room for improvement cat chapter-01.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/070-tagging/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/070-tagging/</guid><description>Alice: tagging Lab Our writer decides that she doesn&amp;rsquo;t need to keep enhancing the vocabulary of the first chapter (at least for now), so she proceeds to delete the branch (--decorate is required to show the tags if the output is pipelined) git log --graph --oneline --decorate \ | grep &amp;#34;Replaced struggling and shore.&amp;#34; -C 9999 git branch -d vocabulary-chapter-01 git branch After applying the -d, commits don&amp;rsquo;t belong to vocabulary-chapter-01, as the branch doesn&amp;rsquo;t exists anymore: git log --graph --oneline --decorate \ | grep &amp;#34;Replaced struggling and shore.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/080-cloning-repositories/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/080-cloning-repositories/</guid><description>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 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 .</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/090-pushing-to-origin/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/090-pushing-to-origin/</guid><description>Bob: pushing to origin Lab Imbued with the creativity provided by a good cup of coffee, Bob writes his part of the book and commits the changes on his own repository cat &amp;lt;&amp;lt; EOF &amp;gt; chapter-02.md Tim couldn&amp;#39;t believe his luck. The stranger had saved his life, and he was filled with gratitude. &amp;#34;Thank you so much,&amp;#34; he said, still panting from the ordeal. &amp;#34;I thought I was going to drown out there.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/100-log-format/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/100-log-format/</guid><description>Alice: merging and log format Our preferred writer is back, and having read Bob&amp;rsquo;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.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/110-bare-repos/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/110-bare-repos/</guid><description>Alice: centralized repository creation Alice is going to create a repository intended to have only the data, without any working directory. This way, both Alice and Bob will be able to work against a common integration branch.
Lab First, Alice goes to the top directory to create the folder for the new repo. By convention, a bare repos directory name ends with .git: cd mkdir central.git Jumping inside the newly created directory, our Writer is able to initialize it properly cd central.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/120-pull/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/120-pull/</guid><description>Bob: pulling Lab Bob doesn&amp;rsquo;t want to write anything today, but he is interested in reading what Alice has added to the story. First, he will check his own repository and ensure he is using the main branch cd bob/book git status git checkout main Alice has told him to update the remote reference to point to the new bare repo, so Bob starts by checking the old value git remote git remote get-url origin Yes, definitively he has to change the value of the origin repo, but he doesn't want to loose the current one, so he renames it git remote ██████ origin alice git remote Solution git remote rename origin alice git remote Now Bob can safely create the new remote reference git remote add origin .</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/130-reflog/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/130-reflog/</guid><description>Bob: recovering from errors with the reference log Bob has many nice traits, but he is not the most focused person in the world. Luckily for him, it is very difficult to really mess up things while using git.
Lab Bob comes back to the computer to keep working on the novel. cd bob/book git branch He realizes that he is not on his wip branch, so he changes to it git checkout wip-chapter-02 git status He has a very nice idea about how to continue with the story, and wants to write it down before it vanishes from his mind cat &amp;lt;&amp;lt; EOF &amp;gt; chapter-04.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/140-blame/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/140-blame/</guid><description>Bob finds the author of a typo Here we will see how Bob is able to trace who introduced a bug in the novel, in the form of a spelling error.
Lab: Alice Alice worked for a lot hours today, and although she is exhausted, she also wants to review the state of the book. So she goes to her repo and gets the updates cd alice/book git pull origin main The new chapter written by Bob looks very promising!</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/150-amending-commits/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/150-amending-commits/</guid><description>Alice: amending commits It is easy to realize there was an error just a second after commiting some files. Here, Alice will correct one of such mistakes.
Lab She starts by reaching her working area cd alice/book Alice just realizes they forgot to write the name of the different chapters. It is going to take some work to correct it, so she creates a new branch (the project is starting to get some complexity, so she agrees with Bob to use feat as the prefix for feature oriented branches) git checkout -b feat_headings Now she will start updating the different chapters, starting with the first one: sed -i &amp;#39;2i\## Chapter one&amp;#39; chapter-01.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/160-history-simplification/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/160-history-simplification/</guid><description>Alice: history simplification In this laboratory, our best writer will make some changes, but simplifying the log before merging her working branch with main to avoid generating noise.
Lab Alice updated the title of the first chapter, but after taking some time for drinking coffee, she prefers to ensure she is in the correct directory: cd alice/book git status git log --oneline Everything looks fine, so she continues editing the rest of the chapters sed -i &amp;#39;1s/^/## Chapter two\n\n/&amp;#39; chapter-02.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/170-cherry-picking/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/170-cherry-picking/</guid><description>Alice: cherry picking changesets During this lab, Alice will work on two different features at the same time in separated branches. She will realize that there is a change implemented in one of those branches that would be nice to have in the other one, so she will integrate only that particular update.
Lab Alice selects her working area cd alice/book git status And creates the new branch in which will add metadata content, like the biography of the authors of the book git checkout -b feat-meta cat &amp;lt;&amp;lt; EOF &amp;gt; about-authors.</description></item><item><title/><link>https://mcatrisse.github.io/git-workshop-lab/posts/readme/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcatrisse.github.io/git-workshop-lab/posts/readme/</guid><description>Git Workshop Lab</description></item></channel></rss>