{"id":28181626,"url":"https://github.com/victorcazanave/git-training","last_synced_at":"2026-04-27T11:31:35.888Z","repository":{"id":26738382,"uuid":"30196034","full_name":"VictorCazanave/git-training","owner":"VictorCazanave","description":"A training to use Git","archived":false,"fork":false,"pushed_at":"2017-08-28T21:46:16.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T03:13:26.649Z","etag":null,"topics":["exercise","git","rebase","training"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VictorCazanave.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-02T16:25:08.000Z","updated_at":"2017-08-28T21:47:22.000Z","dependencies_parsed_at":"2022-07-24T11:46:14.170Z","dependency_job_id":null,"html_url":"https://github.com/VictorCazanave/git-training","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/VictorCazanave/git-training","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorCazanave%2Fgit-training","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorCazanave%2Fgit-training/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorCazanave%2Fgit-training/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorCazanave%2Fgit-training/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VictorCazanave","download_url":"https://codeload.github.com/VictorCazanave/git-training/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorCazanave%2Fgit-training/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32335295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["exercise","git","rebase","training"],"created_at":"2025-05-16T03:13:25.236Z","updated_at":"2026-04-27T11:31:35.863Z","avatar_url":"https://github.com/VictorCazanave.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git Training\nGit Training is a list of exercises to practice using Git.\n\nFor now these exercises are focused on the rebase workflow.\n\n## How to use it\n* Fork this repository\n* Clone your repository on your local machine: `git clone https://github.com/\u003cyour name\u003e/git-training.git`\n* Launch init script to create all local branches: `sh init.sh`\n* Do the exercises in the same order\n* You can find help in the [tips and links](#tips-and-links)\n* You can compare your solutions with [mine](#solutions)\n* You can [open an issue](/issues) if you find a mistake/bug or if you have any question\n\n## Exercises\n\n### 01. Rebase without conflict\n_The goal of this exercise is to do a basic rebase._\n\nRebase the ex01 branch on the master branch.\n\n[Solution](#01-rebase-without-conflict-1)\n\n### 02. Rebase with conflicts\n_The goal of this exercise is to do a rebase with conflicts (no fear!)._\n\nRebase the ex02 branch on the master branch resolving the conflicts as you want.\n\n[Solution](#02-rebase-with-conflicts-1)\n\n### 03. Abort a rebase\n_The goal of this exercise is to stop an ongoing rebase._\n\nStart to rebase the ex03 branch on the master branch but when the conflict is detected, abort the rebase.\n\n[Solution](#03-abort-a-rebase-1)\n\n### 04. Cancel a local rebase\n_The goal of this exercise is to cancel a rebase that has been done only on a local branch._\n\nRebase the ex04 branch on the master branch but **do not push** the rebased local branch and cancel all its changes.\n\n[Solution](#04-cancel-a-local-rebase-1)\n\n### 05. Rename a commit during a rebase\n_The goal of this exercise is to change the message of a commit._\n\nRebase the ex05 branch on the master branch and rewrite the commit's message.\n\n[Solution](#05-rename-a-commit-during-a-rebase-1)\n\n### 06. Merge commits during a rebase\n_The goal of this exercise is to merge commits._\n\nRebase the ex06 branch on the master branch and squash the two commits.\n\n[Solution](#06-merge-commits-during-a-rebase)\n\n### 07. Delete a commit during a rebase\n_The goal of this exercise is to delete a commit._\n\nRebase the ex07 branch on the master branch and remove the first commit.\n\n[Solution](#07-delete-a-commit-during-a-rebase)\n\n### 08. Rewrite commits history during a rebase\n_The goal of this exercise is to clean the commits history._\n\nRebase the ex08 branch on the master branch to have only one commit for each file.  \nUsing the previous exercises:\n* Delete wrong commits\n* Merge commits which update the same file\n* Rewrite wrong commit messages\n\n[Solution](#08-rewrite-commits-history-during-a-rebase-1)\n\n## Tips and links\n\n### Update the local master branch:\n* Update the remote master branch: `git fetch origin master`\n* Go on the master branch: `git checkout master`\n* Update the local master branch: `git rebase master origin/master`\n\nSince we will not commit directly on the master branch, we can also use:\n* Go on the master branch: `git checkout master`\n* Update the local master branch: `git pull origin master`\n\n### Resolve a conflict\nThere are 3 ways to resolve a conflict:\n* Choose the feature file as the right version: `git checkout --ours -- \u003cpaths\u003e`\n* Choose the master file as the right version: `git checkout --theirs -- \u003cpaths\u003e`\n* Edit the file to create a correct merged version and continue the rebase: `git add \u003cpaths\u003e` then `git rebase --continue`\n\n### Links\n* [Git Documentation](http://git-scm.com/doc)\n\n## Solutions\nThese are examples of solutions but it is not the only way to solve the exercises.\n\n### 01. Rebase without conflict\n* [Update the local master branch](#update-the-local-master-branch)\n* Go on the ex01 branch : `git checkout ex01`\n* Rebase the ex01 branch on master branch : `git rebase master`\n* Update the remote ex01 branch: `git push -f origin ex01`\n\nSince there is no conflict between master and ex01 branches, the rebase is easily done.\n\n### 02. Rebase with conflicts\n* [Update the local master branch](#update-the-local-master-branch)\n* Go on the ex02 branch : `git checkout ex02`\n* Rebase the ex02 branch on master branch : `git rebase master`\n* [Resolve the conflicts](#resolve-a-conflict)\n* Update the remote ex02 branch: `git push -f origin ex02`\n\n### 03. Abort a rebase\n* [Update the local master branch](#update-the-local-master-branch)\n* Go on the ex03 branch : `git checkout ex03`\n* Rebase the ex03 branch on master branch : `git rebase master`\n* There also conflicts but in this case we will no resolve it.\n* Abort the rebase: `git rebase --abort`\n\n### 04. Cancel a local rebase\n* [Update the local master branch](#update-the-local-master-branch)\n* Go on the ex04 branch : `git checkout ex04`\n* Rebase the ex04 branch on master branch : `git rebase master`\n* The local ex04 branch is now rebased but we will reset it: `git reset --hard origin/ex04`\n\n### 05. Rename a commit during a rebase\n* [Update the local master branch](#update-the-local-master-branch)\n* Go on the ex05 branch : `git checkout ex05`\n* Rebase the ex05 branch on master branch : `git rebase -i master`\n* Change the pick command of the commit to reword it: `reword 72c9250 Update file05 with wrong commit message`\n* Write the new commit's message: `Update file05`\n* Update the remote ex05 branch: `git push -f origin ex05`\n\n### 06. Merge commits during a rebase\n* [Update the local master branch](#update-the-local-master-branch)\n* Go on the ex06 branch : `git checkout ex06`\n* Rebase the ex06 branch on master branch : `git rebase -i master`\n* Change the pick command of the second commit to fixup the first one: `fixup c944dd5 Update file06`\n* Update the remote ex06 branch: `git push -f origin ex06`\n\n### 07. Delete a commit during a rebase\n* [Update the local master branch](#update-the-local-master-branch)\n* Go on the ex07 branch : `git checkout ex07`\n* Rebase the ex07 branch on master branch : `git rebase -i master`\n* Delete the first commit's line: `pick a5779a9 Commit to delete`\n* Update the remote ex07 branch: `git push -f origin ex07`\n\n### 08. Rewrite commits history during a rebase\n* [Update the local master branch](#update-the-local-master-branch)\n* Go on the ex08 branch : `git checkout ex08`\n* Rebase the ex08 branch on master branch : `git rebase -i master`\n* The commits history should look like this:\n   ```\n   pick 14a9611 Update file08-1\n   pick befa615 Update file08-3\n   pick 7d5dfc9 Update file08-1\n   pick 634e37a Wrong commit message to update file08-2\n   pick 5760138 Wrong commit to update file08-3\n   pick 9723627 Update file08-2\n   pick 34e3c2f Update file08-1\n   ```\n\n* Modify the commits history to :\n  * Delete the wrong commit: `pick 5760138 Wrong commit to update file08-3`\n  * Group the commits about the same file keeping the same order:\n    * file01:\n      ```\n      pick 14a9611 Update file08-1\n      pick 7d5dfc9 Update file08-1\n      pick 34e3c2f Update file08-1\n      ```\n\n    * file02:\n      ```\n      pick 634e37a Wrong commit message to update file08-2\n      pick 9723627 Update file08-2\n      ```\n\n    * file03:\n      ```\n      pick befa615 Update file08-3\n      ```\n\n  * Merge the commits about the same file:\n    * file01:\n      ```\n      pick 14a9611 Update file08-1\n      fixup 7d5dfc9 Update file08-1\n      fixup 34e3c2f Update file08-1\n      ```\n\n    * file02:\n      ```\n      pick 634e37a Wrong commit message to update file08-2\n      fixup 9723627 Update file08-2\n      ```\n\n  * Rewrite the wrong commit message: `reword 634e37a Wrong commit message to update file08-2`\n\n* The final result should look like this:\n   ```\n   pick 14a9611 Update file08-1\n   fixup 7d5dfc9 Update file08-1\n   fixup 34e3c2f Update file08-1\n   reword 634e37a Wrong commit message to update file08-2\n   fixup 9723627 Update file08-2\n   pick befa615 Update file08-3\n   ```\n\n* Update the remote ex08 branch: `git push -f origin ex08`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorcazanave%2Fgit-training","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorcazanave%2Fgit-training","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorcazanave%2Fgit-training/lists"}