From 31c462859fed6a03e6c977bbaa37bc025b347fda Mon Sep 17 00:00:00 2001
From: laurentheirendt <laurent.heirendt@uni.lu>
Date: Mon, 23 Sep 2019 11:54:13 +0200
Subject: [PATCH] overall changes to fit partial cherry-picking and note on
 common commands

---
 .../slides/chPick.md                          | 61 ++++++++++++++++---
 .../slides/gettingStarted.md                  | 22 +++++++
 .../slides/headRebase.md                      | 15 -----
 .../slides/list.json                          |  1 -
 .../slides/rebase.md                          |  6 +-
 5 files changed, 78 insertions(+), 27 deletions(-)
 delete mode 100644 2019/2019-09-24_advancedGitTraining/slides/headRebase.md

diff --git a/2019/2019-09-24_advancedGitTraining/slides/chPick.md b/2019/2019-09-24_advancedGitTraining/slides/chPick.md
index d90e8539..63d3bdbc 100644
--- a/2019/2019-09-24_advancedGitTraining/slides/chPick.md
+++ b/2019/2019-09-24_advancedGitTraining/slides/chPick.md
@@ -11,13 +11,6 @@
 
 # Example (1)
 
-* In your branch `myBranch`, create and commit a reference file `references.md`:
-```bash
-$ git checkout myBranch
-$ echo "# References" > references.md
-$ # add and commit the file references.md
-```
-
 * Create and commit two files in the `develop `branch
 ```bash
 $ echo "# Venue details" > location.md
@@ -35,7 +28,7 @@ $ # add and commit the file speakers.md
 $ git checkout myBranch
 $ git cherry-pick <SHA1>
 ```
-* Check the log again and see if the changes were applied correctly
+* Check the log again and see if the changes were applied correctly. Note the new SHA1!
 ```bash
 $ git show <newSHA1>
 ```
@@ -46,4 +39,54 @@ $ git show <newSHA1>
 $ git push origin myBranch
 ```
 
-* Note that the `-f` flag is not needed to force push (no history has been rewritten)
\ No newline at end of file
+* Note that the `-f` flag is not needed to force push (no history has been rewritten)
+
+
+
+# Partial chery-picking
+
+* Partial cherry-picking allows you to unpack the changes from a commit.
+* Imagine you committed many files, and you want to remove certain files.
+* In practice:
+    - You commited all files, and you realize that there is your data inside!
+    - You have committed accidentally sensitive data, such as your password
+    - You committed hidden files, for instance `.DS_Store` files
+
+
+
+
+# Example (1)
+
+* Reset the `develop` branch:
+```bash
+$ git checkout develop
+$ git reset HEAD~2
+```
+* Add the `location.md` and the `speakers.md` files as 1 commit:
+```bash
+$ echo "# Venue details" > location.md
+$ echo "# Speakers" > speakers.md
+$ git add location.md speakers.md
+$ git commit -m "add location and speakers files"
+```
+
+
+
+# Example (2)
+
+Cherry-pick the commit from `develop` over to `myBranch`:
+
+```bash
+$ git checkout myBranch
+$ git cherry-pick -n <SHA1>
+$ git status
+```
+Now, remove the file `location.md`:
+```bash
+$ git restore --staged location.md
+$ rm location.md
+```
+Commit the changes:
+```bash
+$ git commit -m "add speakers file"
+```
diff --git a/2019/2019-09-24_advancedGitTraining/slides/gettingStarted.md b/2019/2019-09-24_advancedGitTraining/slides/gettingStarted.md
index 1b186341..e064d0ea 100644
--- a/2019/2019-09-24_advancedGitTraining/slides/gettingStarted.md
+++ b/2019/2019-09-24_advancedGitTraining/slides/gettingStarted.md
@@ -24,3 +24,25 @@ Create your own branch `myBranch` based on the `develop` branch from `usptream`
 ```bash
 $ git checkout -b <mybranch> upstream/develop
 ```
+
+
+
+# A note on common commands:
+
+This workshop will not cover in detail the following commands, assuming you are familiar with them:
+
+- `git checkout`
+- `git add`
+- `git commit`
+- `git log`
+- `git show`
+
+Feel free to ask any questions if you run into any issues!
+
+For your reference:
+```bash
+$ git <command> --help
+```
+Replace `<command>` with the command you want help for.
+
+Exit with `q`
diff --git a/2019/2019-09-24_advancedGitTraining/slides/headRebase.md b/2019/2019-09-24_advancedGitTraining/slides/headRebase.md
deleted file mode 100644
index e38db5aa..00000000
--- a/2019/2019-09-24_advancedGitTraining/slides/headRebase.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Theory: Amending with Git Rebase
-
-* The same operations can be made with `git rebase -i`
-
-* The flag HEAD~X will let you amend the X previous commits instead of just the last one
-
-* In the Interactive rebase menu, be sure to select the `edit` option.
-
-
-
-# Practical: Amending with Git Rebase
-
-```bash
-$ git rebase -i HEAD~3
-```
\ No newline at end of file
diff --git a/2019/2019-09-24_advancedGitTraining/slides/list.json b/2019/2019-09-24_advancedGitTraining/slides/list.json
index 93c76673..bcd5e588 100644
--- a/2019/2019-09-24_advancedGitTraining/slides/list.json
+++ b/2019/2019-09-24_advancedGitTraining/slides/list.json
@@ -7,7 +7,6 @@
     { "filename": "revert.md" },
     { "filename": "rebase.md" },
     { "filename": "chPick.md" },
-    { "filename": "headRebase.md" },
     { "filename": "merge.md" },
     { "filename": "conflict.md" },
     { "filename": "kdiff3Install.md" },
diff --git a/2019/2019-09-24_advancedGitTraining/slides/rebase.md b/2019/2019-09-24_advancedGitTraining/slides/rebase.md
index e7d96f5a..b4a262c6 100644
--- a/2019/2019-09-24_advancedGitTraining/slides/rebase.md
+++ b/2019/2019-09-24_advancedGitTraining/slides/rebase.md
@@ -102,8 +102,10 @@ $ git push origin yourBranch
 
 Now, we want to:
 
--  Reword the first commit's message to: `Add William and Roberta to attendee list`
--  Combine the second and first commit into one, omitting the commit message of the second commit.
+- Reword the first commit's message to: `Add William and Roberta to attendee list`
+- Combine the second and first commit into one
+- Omit the commit message of the second commit.
+
 
 
 
-- 
GitLab