{"id":15007958,"url":"https://github.com/s0mewha7/learn-git-branching","last_synced_at":"2026-03-16T02:36:11.020Z","repository":{"id":257314036,"uuid":"857895874","full_name":"s0mewha7/learn-git-branching","owner":"s0mewha7","description":"my old solutions and notes for the Learn Git Branching tutorial https://learngitbranching.js.org/","archived":false,"fork":false,"pushed_at":"2024-09-15T22:09:52.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T19:59:35.908Z","etag":null,"topics":["git","github","learn","learn-git","learn-git-branching","learn-github","learning-by-doing"],"latest_commit_sha":null,"homepage":"","language":null,"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/s0mewha7.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-15T22:05:37.000Z","updated_at":"2024-09-15T22:11:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"4e67fc34-5c7f-4531-a2b8-e391e68b6bf5","html_url":"https://github.com/s0mewha7/learn-git-branching","commit_stats":null,"previous_names":["s0mewha7/learn-git-branching"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0mewha7%2Flearn-git-branching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0mewha7%2Flearn-git-branching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0mewha7%2Flearn-git-branching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0mewha7%2Flearn-git-branching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s0mewha7","download_url":"https://codeload.github.com/s0mewha7/learn-git-branching/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243180486,"owners_count":20249295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["git","github","learn","learn-git","learn-git-branching","learn-github","learning-by-doing"],"created_at":"2024-09-24T19:14:39.313Z","updated_at":"2025-12-26T02:37:01.095Z","avatar_url":"https://github.com/s0mewha7.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning Git Branching\r\n\r\nPlease do not continue if you have not learned the content covered in these assignments. It is important to learn the material. However if, like me, you find yourself needing to complete arbitrary tasks for classes you are capable of testing out of - but its not offered. Please continue...\r\n\r\n**README: To use this quickly, copy and paste the entire block of code in the 'console' using CTRL-V. They have been written so you do not need to copy each line, one-by-one**\r\n\r\n## Main\r\n\r\n### 1.1 Introduction to Git Commits\r\n```\r\ngit commit;\r\ngit commit;\r\n```\r\n\r\n### 1.2 Branching in Git\r\n```\r\ngit branch bugFix;\r\ngit checkout bugFix;\r\n```\r\n\r\n### 1.3 Merging in Git\r\n```\r\ngit checkout -b bugFix;\r\ngit commit;\r\ngit checkout main;\r\ngit commit;\r\ngit merge bugFix;\r\n```\r\n\r\n### 1.4  Rebase Introduction\r\n```\r\ngit checkout -b bugFix;\r\ngit commit;\r\ngit checkout main;\r\ngit commit;\r\ngit checkout bugFix;\r\ngit rebase main;\r\n```\r\n\r\n### 2.1 Detach yo’ HEAD\r\n```\r\ngit checkout C4;\r\n```\r\n\r\n### 2.2 Relative refs (^)\r\n```\r\ngit checkout C4^;\r\n```\r\n\r\n### 2.3 Relative refs #2 \r\n```\r\ngit branch -f main C6;\r\ngit branch -f bugFix C0;\r\ngit checkout C1;\r\n```\r\n\r\n### 2.4 Reversing Changes in Git\r\n```\r\ngit reset local~1;\r\ngit checkout pushed;\r\ngit revert pushed;\r\n```\r\n\r\n### 3.1 Cherry-pick Intro\r\n```\r\ngit cherry-pick C3 C4 C7;\r\n```\r\n\r\n### 3.2 Interactive Rebase Intro\r\n```\r\ngit rebase -i main~4 --aboveAll;\r\n```\r\n*For the solution, order the commits as C3, C5, C4. You may need to omit or pick commits.*\r\n\r\n### 4.1 Grabbing Just 1 Commit\r\n```\r\ngit checkout main;\r\ngit cherry-pick C4;\r\n```\r\n\r\n### 4.2 Juggling Commits\r\n```\r\ngit rebase -i caption~2 --aboveAll;\r\ngit commit --amend;\r\ngit rebase -i caption~2 --aboveAll;\r\ngit branch -f master caption;\r\n```\r\n*1) For the solution, order the commits as C3, C2. You may need to omit or pick commits.*\r\n\r\n*2) For the solution, order the commits as C2'', C3'. You may need to omit or pick commits.*\r\n\r\n### 4.3 Juggling Commits #2\r\n```\r\ngit checkout main;\r\ngit cherry-pick C2;\r\ngit commit --amend;\r\ngit cherry-pick C3;\r\n```\r\n\r\n### 4.4 Git Tags\r\n```\r\ngit tag v0 C1;\r\ngit tag v1 C2;\r\ngit checkout C2;\r\n```\r\n\r\n### 4.5 Git Describe\r\n```\r\ngit commit;\r\n```\r\n\r\n### 5.1 Rebasing over 9000 times\r\n```\r\ngit rebase main bugFix;\r\ngit rebase bugFix side;\r\ngit rebase side another;\r\ngit rebase another master;\r\n```\r\n\r\n### 5.2 Multiple parents\r\n```\r\ngit branch bugWork main~^2~;\r\n```\r\n\r\n### 5.3 Branch Spaghetti\r\n```\r\ngit checkout one;\r\ngit cherry-pick C4 C3 C2;\r\ngit checkout two;\r\ngit cherry-pick C5 C4 C3 C2;\r\ngit branch -f three C2;\r\n```\r\n\r\n## Remote\r\n\r\n\r\n### 1.1 Clone Intro\r\n```\r\ngit clone;\r\n```\r\n\r\n### 1.2 Remote Branches\r\n```\r\ngit commit;\r\ngit checkout o/main;\r\ngit commit;\r\n```\r\n\r\n### 1.3 Git Fetchin’\r\n```\r\ngit fetch;\r\n```\r\n\r\n### 1.4 Git Pullin’\r\n```\r\ngit pull;\r\n```\r\n\r\n### 1.5 Fakeing Teamwork\r\n```\r\ngit clone;\r\ngit fakeTeamwork main 2;\r\ngit commit;\r\ngit pull;\r\n```\r\n\r\n### 1.6 Git Pushin’\r\n```\r\ngit clone;\r\ngit commit;\r\ngit commit;\r\ngit push;\r\n```\r\n\r\n### 1.7 Diverged History\r\n```\r\ngit clone;\r\ngit fakeTeamwork;\r\ngit commit;\r\ngit pull --rebase;\r\ngit push;\r\n```\r\n### 1.8 Diverged History\r\n```\r\ngit reset --hard o/master\r\ngit checkout -b feature C2\r\ngit push\r\n```\r\n### 2.1 Push Master!\r\n```\r\ngit fetch;\r\ngit rebase o/main side1;\r\ngit rebase side1 side2;\r\ngit rebase side2 side3;\r\ngit rebase side3 main;\r\ngit push;\r\n```\r\n\r\n### 2.2 Mering with remotes\r\n```\r\ngit checkout main;\r\ngit pull;\r\ngit merge side1;\r\ngit merge side2;\r\ngit merge side3;\r\ngit push;\r\n```\r\n\r\n### 2.3 Remoting Tracking\r\n```\r\ngit checkout -b side o/main;\r\ngit commit;\r\ngit pull --rebase;\r\ngit push;\r\n```\r\n\r\n### 2.4 Git push arguments\r\n```\r\ngit push origin main;\r\ngit push origin foo;\r\n```\r\n\r\n### 2.5 Git push arguments — Expanded!\r\n```\r\ngit push origin main~1:foo;\r\ngit push origin foo:master;\r\n```\r\n\r\n### 2.6 Fetch arguments\r\n```\r\ngit fetch origin c6:main\r\ngit fetch origin c3:foo\r\ngit checkout foo\r\ngit merge main\r\n```\r\n\r\n### 2.7 Source of nothing\r\n```\r\ngit push origin :foo;\r\ngit fetch origin :bar;\r\n```\r\n### 2.8 Pull arguments\r\n```\r\ngit fetch origin c3:foo\r\ngit fetch origin c2:side\r\ngit merge foo\r\ngit merge side\r\n```\r\n\r\n![Screenshot from 2024-09-16 00-48-48](https://github.com/user-attachments/assets/f4c032f1-5d57-4af8-b478-14ace6852450)\r\n\r\n![Screenshot from 2024-09-16 00-49-03](https://github.com/user-attachments/assets/6a46aed0-de81-4654-b6ad-36521a5cca63)\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs0mewha7%2Flearn-git-branching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs0mewha7%2Flearn-git-branching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs0mewha7%2Flearn-git-branching/lists"}