Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Courses
Git
Advanced Git
Commits
1ec19d4c
Commit
1ec19d4c
authored
Mar 10, 2022
by
Mroik
Browse files
Merge branch 'edit-2022' into 'master'
Changes to the slides for the 2022 edition See merge request
!2
parents
8681848f
1b936e8c
Pipeline
#1351
passed with stage
in 1 minute and 23 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
slides/content.md
View file @
1ec19d4c
...
...
@@ -2,9 +2,9 @@
### What we'll talk about:
*
Using git repos in a git repo:
**submodule**
*
Moving a branch 'ahead':
**rebase**
*
Extracting commits from other branches:
**cherry-pick**
*
Storing changes for later use:
**stash**
*
Moving a branch 'ahead':
**rebase**
*
Finding out who made a mistake:
**blame**
----
...
...
@@ -25,14 +25,6 @@
## Submodule: What can it do?
A submodule will appear as a subdirectory of our own repository.
<!-- .element: class="fragment" -->
Cloning a repository that contains a submodule will not clone it.
<!-- .element: class="fragment" -->
---
## Submodule: What can it do?
Once created the sumodule will point always to the same commit.
<!-- .element: class="fragment" -->
Every edit we make inside our submodule will not be pushed upstream.
<!-- .element: class="fragment" -->
...
...
@@ -55,50 +47,6 @@ git submodule update --init --recursive submodule_directory
----
# Moving changes
## Cherry Pick and Stash

---
## Git Cherry Pick: When do I need it?
<div>
<!-- .element: class="fragment" -->
I need it when I want to import a
**single**
commit or
**a range**
of commits from another branch.
</div>
---
## Git Cherry Pick: What can it do?
<div>
<!-- .element: class="fragment" -->
Using
**cherry pick**
, git will perform a "rebase" (we will see later).
</div>
<div>
<!-- .element: class="fragment" -->
**N.B.**
We still need to resolve any conflicts (if needed).
</div>
---
## Git Cherry Pick: Syntax
#### Take a single commit and apply on current branch
```
bash
git cherry-pick <commit
hash
>
# single commit form
git cherry-pick <
hash
start>..<
hash
end>
# commit range form
```
----
## Git Stash
---
...
...
@@ -190,6 +138,51 @@ git rebase <branch A name>
----
# Moving changes
## Cherry Pick and Stash

---
## Git Cherry Pick: When do I need it?
<div>
<!-- .element: class="fragment" -->
I need it when I want to import a
**single**
commit or
**a range**
of commits from another branch.
</div>
---
## Git Cherry Pick: What can it do?
<div>
<!-- .element: class="fragment" -->
Using
**cherry pick**
, git will perform a "rebase" (we will see later).
</div>
<div>
<!-- .element: class="fragment" -->
**N.B.**
We still need to resolve any conflicts (if needed).
</div>
---
## Git Cherry Pick: Syntax
#### Take a single commit and apply on current branch
```
bash
git cherry-pick <commit
hash
>
# single commit form
git cherry-pick <
hash
start>..<
hash
end>
# commit range form
```
----
# Who did this?!
## Blame
...
...
@@ -235,6 +228,16 @@ What should I use to find a bug if I don't know which lines caused it? <!-- .ele
----
## What does it do?
Does a binary search to find the commit that introduced a bug by flagging a
starting bad commit and a known good commit
To start use
**git bisect start**
.
Flag a good commit with
**git bisect good**
and a bad one with
**git bisect bad**
----
## Disaster Recovery
### What we'll talk about:
...
...
@@ -365,6 +368,7 @@ the ones that are unreachable and the intermediate commits of a rebase
-
[
__Emanuele Santoro__
](
http://santoro.tk
)
-
__Luca Fusé__
-
__Giacomo Vercesi__
For their fantastic slides on advanced git topics of the previous years
slides/intro.html
View file @
1ec19d4c
<section
class=
"intro"
>
<h1>
Advanced Git
&
Disaster Recovery
</h1>
<h1>
Advanced Git
</h1>
<h2>
Stuff you probably don't need
</h2>
<h3>
We're gonna explain it anyway
</h3>
<img
src=
"./poul/img/logo-text-white.svg"
/>
<p>
Giacomo Vercesi
<
1vercesig@gmail.com
>
</p>
<p>
Mirko
<
mroik@poul.org
>
<br>
frigobar
<
frigobar@poul.org
>
<br>
Vechapw
<
vechapw@poul.org
>
</p>
</section>
slides/outro.html
View file @
1ec19d4c
...
...
@@ -7,5 +7,7 @@
<img
class=
"cc"
src=
"./poul/img/creativecommons-by-nc-sa.svg"
/>
<p>
Giacomo Vercesi
<
1vercesig@gmail.com
>
</p>
<p>
Mirko
<
mroik@poul.org
>
<br>
frigobar
<
frigobar@poul.org
>
<br>
Vechapw
<
vechapw@poul.org
>
</p>
</section>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment