Skip to content
Snippets Groups Projects
Verified Commit 7dc7f6ee authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

minor changes

parent 4e5353e7
No related branches found
No related tags found
2 merge requests!47Regular merge of develop,!46minor changes for advanced training
......@@ -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"
```
......
# 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;">
......
# 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
......@@ -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>
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment