Git Advanced

This is a README.adoc file. The original repository is located here.

Task Git Advanced

Fenrir ID: git/ad-nib
Points: 50

Task submission

Do not create any merge request! Just push all the branches to the remote repository.

Tests check each commit’s hash: do not create any extra commits unless it is stated. Use detached mode to check out to the required branch and create a local branch from the commit you’ve switched to.

Each part adds 10 points to the final score.

Task description

The task sources are available here. Add this repository as a remote and fetch all branches.

Part 1 (Task rebase)

Switch to the rebase branch and apply these changes:

  • Rename naples to napoli

  • Drop genova commit

  • Developers forgot to make script.sh executable in roma : fix it

  • Squash firenze and bologna into a single commit with torino message and firenze & bologna body

Part 2 (Task ignore)

Use supplementary branch to find the sources

Create branch ignore from the main branch in foreign.bundle. Add .gitignore file which:

  • Forbids to commit bin directory

  • Forbids to commit any file with extension .o except o.o in the project’s root directory

Only one commit is allowed apart from the bundle’s commits.

Part 3 (Task hooks)

Sometimes developers forget to make .sh-scripts executable. Create a git hook which corrects this mistake.

To use the hook create an additional script install which installs the hook. The solution must be committed to the hooks branch.

Use the following templates:

install
#! /bin/bash

set -e

# TODO: your commands (e.g. move script.sh to the correct place)
script.sh
#! /bin/bash

for file in $(/* TODO: command that lists all updated filed */); do
	if [[ "$file" == *.sh ]]; then
		# TODO: command that makes .sh files executable
	fi
done
Для достижения желаемого вам могут понадобиться низкоуровневые команды: git diff, git diff-index, git update-index

Part 4 (Task submodules)

Create a public fork of this repository. The fork must be located in your user’s namespace. The fork name must be koshej.

Add the fork as a submodule to your project (branch submodules). It must be cloned to koshchei directory.

Add this repository as another submodule. It must be cloned to oak/hare directory.

Create a script setup.sh which downloads the data from all the repositories and updates all the dependencies (e.g. one of submodules might be outdated by default). The solution must be committed to submodules branch.

Use http links instead of ssh ones!

Part 5

Use supplementary branch to find the sources

Add file logo.png. Store it in LFS. To prevent changes, lock it. The solution must be committed to lfs branch.

Questions

  • What happens to commits when an interactive rebase is used?

  • How to use/extract files from another branch? (Try to use commands from the previous task)

  • What happens when you try to merge branches that have no common ancestor?

  • Which sequence of commands does GitLab/GitHub use to create a fork?

  • Provide a scenario when the committer and the author differ without any explicit modifications.

The project is licensed under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

© 2026-present Iwan Kalinin <koefic.cien@gmail.com>