diff --git a/2019/2019-09-24_advancedGitTraining/slides/amend.md b/2019/2019-09-24_advancedGitTraining/slides/amend.md index 9f4974cac975de37472391b27204a8b1afeb316b..36b501c1587926ff640e4d622f33ddcf12570b03 100644 --- a/2019/2019-09-24_advancedGitTraining/slides/amend.md +++ b/2019/2019-09-24_advancedGitTraining/slides/amend.md @@ -26,7 +26,7 @@ $ git status * Use `git commit --amend` to change the commit - Alternatively, you can use the `-m` flag to edit only the commit message: +* Alternatively, you can use the `-m` flag to edit only the commit message: ```bash $ git commit --amend -m "Add title" ``` diff --git a/2019/2019-09-24_advancedGitTraining/slides/chPick.md b/2019/2019-09-24_advancedGitTraining/slides/chPick.md index f865ef90cf65445ac76102a5573bfe95b20fea20..ef2af9e83483829bb9db244516998a5d65c59557 100644 --- a/2019/2019-09-24_advancedGitTraining/slides/chPick.md +++ b/2019/2019-09-24_advancedGitTraining/slides/chPick.md @@ -1,6 +1,7 @@ # Cherry-picking * Cherry-picking allows to pick one (or more) specific commits from a list of commits. + * Only the chosen commit(s) are picked, not everything up to that commit. <div style="top: 8em; left: 25%; position: absolute;"> diff --git a/2019/2019-09-24_advancedGitTraining/slides/rebase.md b/2019/2019-09-24_advancedGitTraining/slides/rebase.md index 8fc767e99eb86728f0b861896a443c9ff3078568..cc4197aeb17cd235112545ffcf168856e63c1354 100644 --- a/2019/2019-09-24_advancedGitTraining/slides/rebase.md +++ b/2019/2019-09-24_advancedGitTraining/slides/rebase.md @@ -1,24 +1,25 @@ # Rebasing (1) -* `git rebase` enables to forward your commits +* `git rebase` enables to shift forward your commits in time * Move/combine a sequence of commits to a new base commit * Avoid discrepancies when multiple people work on the same project * Linear git history (no merge commits) * Rebasing is like saying, “I want to base my changes on what everybody has already done.†Imagine the following situation: -<div style="top: 10em; left: 30%; position: absolute;"> +<div style="top: 14em; left: 25%; position: absolute;"> <img src="slides/img/beforeRebase.png" height="500px"> </div> +* There are commits on `develop` that aren't in `myBranch`. + # Rebasing (2) -* `myBranch` is several commits ahead of `develop`. -* Commits implemented into `develop` that aren't in `myBranch`. +* After rebase, the commits in the `myBranch` branch will be place on top of `develop`. -<div style="top: 10em; left: 30%; position: absolute;"> +<div style="top: 5em; left: 25%; position: absolute;"> <img src="slides/img/afterRebase.png" height="500px"> </div> @@ -26,7 +27,7 @@ Imagine the following situation: # Example (1): -* A merge request against `develop` is still open. Repository maintainer: review, and merge it. +* A merge request against `develop` is still open. **Repository maintainer: review, and merge it.** * Create a file in your branch `myBranch` ```bash @@ -147,4 +148,9 @@ $ pick 1234567 add william to attendee list $ squash abcdef0 add roberta to attendee list ``` -* This will create a commit with both modified files, with the commit message being a combination of the two commit messages. \ No newline at end of file +* This will create a commit with both modified files, with the commit message being a combination of the two commit messages. + +* Push the changes to `myBranch` with `-f`: +```bash +$ git push origin myBranch -f +``` \ No newline at end of file diff --git a/2019/2019-09-24_advancedGitTraining/slides/reset.md b/2019/2019-09-24_advancedGitTraining/slides/reset.md index 02f423eb1dd99da0bf6bcdaf9908e853cef66c78..1dbceddb25a6bdc797e5e20b723b717cb97a79e2 100644 --- a/2019/2019-09-24_advancedGitTraining/slides/reset.md +++ b/2019/2019-09-24_advancedGitTraining/slides/reset.md @@ -23,7 +23,7 @@ $ git commit -m "add biography for Firstname Lastname" $ git push origin myBranch ``` -* Check the commits, copy the `SHA1` of the second last commit: +* Check the commits, copy the `SHA1` of the **second last** commit: ```bash $ git log ``` @@ -32,7 +32,7 @@ $ git log # Example: Hard reset of a branch (2) -* Use the `reset --hard` command in order to undo the commit with `<SHA1>: +* Use the `reset --hard` command in order to undo the commit with `<SHA1>`: ```bash $ git reset --hard <SHA1> ```