Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions day1/05_Branching/01_Intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ environment.
* Main branch
* Note: Historically it was `master`, many vendors are now moving to `main`
* Develop a new feature in a dedicated branch
* Put fixes into the main branch (production)
* Merge fixes into the main branch (production)
* Continue to work on the feature

!SLIDE smbullets
Expand All @@ -26,6 +26,8 @@ environment.
* List branches
* `git checkout`
* Switch between branches
* `git merge`
* Incorporates commits from a branch into the current one

~~~SECTION:handouts~~~

Expand All @@ -35,6 +37,8 @@ environment.

`git checkout` will switch between branches.

`git merge` incorporate commits from one branch into the current one.

~~~ENDSECTION~~~


Expand Down Expand Up @@ -170,14 +174,55 @@ when working with branches quite often.
$ git checkout -b feature/docs2


!SLIDE smbullets
# Lab ~~~SECTION:MAJOR~~~.~~~SECTION:MINOR~~~: Merge the branch

* Objective:
* Use `git merge` to merge the new branch
* Steps:
* Change into `$HOME/training`
* Modify the `README.md` and commit the change
* Switch to the main branch
* Use `git merge feature/docs` to merge the branch

!SLIDE supplemental solutions
# Lab ~~~SECTION:MAJOR~~~.~~~SECTION:MINOR~~~: Proposed Solution
****

## Merge the branch

****

### Checkout the main branch

@@@ Sh
$ cd $HOME/training

$ git checkout feature/docs
$ vim README.md
$ git add README.md
$ git commit -m "Update README"

### Merge the branch

@@@ Sh
$ git checkout main
$ git merge feature/docs

~~~SECTION:handouts~~~

****

~~~ENDSECTION~~~


!SLIDE smbullets
# Lab ~~~SECTION:MAJOR~~~.~~~SECTION:MINOR~~~: Delete the branch

* Objective:
* Delete the previously created branch
* Steps:
* Change into `$HOME/training`
* Switch to the main branch
* Use `git branch -d` to delete the selected branch
* Bonus:
* Try to delete the branch you are currently on
Expand Down Expand Up @@ -235,4 +280,3 @@ when working with branches quite often.
@@@ Sh
$ git checkout main
$ git branch -d main

30 changes: 25 additions & 5 deletions day2/01_Workflows/02_Centralized.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,31 @@ for integrating and sharing code changes between repositories.

****

~~~ENDSECTION~~~

!SLIDE smbullets
# Centralized Workflow - Merge Conflicts

* Conflicts arise when the same lines in a file have changed
* When merging Git will try to automatically integrate new changes
* Git cannot automatically determine what is correct
* `>>>` marks conflicts and show the differences
* `===` is the barrier between the two states

Important: those markers need to be deleted from the files

Example:

@@@Sh
<<<<<<< HEAD
What is on HEAD
=======
What is on other branch
>>>>>>> other-branch

~~~SECTION:handouts~~~

****

~~~ENDSECTION~~~

Expand Down Expand Up @@ -194,8 +219,6 @@ in a non-fast forward fashion is not allowed.
* Resolve possible merge conflicts, add them
* Continue with `git rebase --continue`, push rebased history

Hint: `>>>` marks conflicts and show the differences on merge/rebase.

~~~SECTION:handouts~~~

****
Expand Down Expand Up @@ -273,6 +296,3 @@ Resolve the conflicts, add the file and continue the rebase.
### Push the changes to the remote repository

$ git push origin main