├── .gitignore ├── 01-a-crash-course-in-git └── projects │ ├── challenge │ └── .keep │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 02-cloning-a-repo └── projects │ ├── challenge │ ├── .keep │ └── 02-challenge.txt │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 03-committing-your-changes └── projects │ ├── challenge │ ├── .keep │ └── 03-challenge.txt │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 04-the-staging-area └── projects │ ├── challenge │ ├── .keep │ └── 04-challenge.txt │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 05-ignoring-files └── projects │ ├── challenge │ ├── .keep │ └── 05-challenge.txt │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 06-git-log-and-viewing-history └── projects │ ├── challenge │ ├── .keep │ └── 06-challenge.txt │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 07-branching └── projects │ ├── challenge │ ├── .keep │ └── 07-challenge.txt │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 08-syncing-with-a-remote └── projects │ ├── challenge │ └── .keep │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 09-creating-a-repo └── projects │ ├── challenge │ └── .keep │ ├── final │ └── .keep │ └── starter │ └── mastering-git-web │ ├── LICENSE │ ├── README.md │ ├── css │ └── style.css │ ├── images │ └── SFR_b+w_-_penguin.jpg │ └── index.html ├── 10-merging └── projects │ ├── challenge │ ├── .keep │ └── 10-challenge.txt │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 11-how-does-git-actually-work └── projects │ ├── challenge │ └── .keep │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 12-merge-conflicts └── projects │ ├── challenge │ ├── .keep │ └── 13-challenge.txt │ ├── final │ ├── .keep │ └── magicSquareJS.zip │ └── starter │ ├── .keep │ └── magicSquareJS.zip ├── 13-stashes └── projects │ ├── challenge │ ├── .keep │ └── 11-challenge.txt │ ├── final │ └── .keep │ └── starter │ └── .keep ├── 14-demystifying-rebasing └── projects │ ├── challenge │ ├── .keep │ ├── 14-challenge.txt │ └── magicSquareJS-challenge.zip │ ├── final │ ├── .keep │ └── magicSquareJS-final.zip │ └── starter │ ├── .keep │ └── magicSquareJS-starter.zip ├── 15-rebasing-to-rewrite-history └── projects │ ├── challenge │ ├── .keep │ └── 15-challenge.txt │ ├── final │ ├── .keep │ └── magicSquareJS-final.zip │ └── starter │ ├── .keep │ └── magicSquareJS-starter.zip ├── 16-gitignore-after-the-fact └── projects │ ├── challenge │ ├── .keep │ └── 16-challenge.txt │ ├── final │ ├── .keep │ └── magicSquareJS-final.zip │ └── starter │ ├── .keep │ └── magicSquareJS-starter.zip ├── 17-many-faces-of-undo └── projects │ ├── challenge │ └── .keep │ ├── final │ ├── .keep │ └── magicSquareJS-final.zip │ └── starter │ ├── .keep │ └── magicSquareJS-starter.zip ├── 18-centralized-workflow └── projects │ ├── final │ ├── .keep │ └── repos.zip │ └── starter │ ├── .keep │ └── repos.zip ├── 19-feature-branch-workflow └── projects │ ├── final │ ├── .keep │ └── repos.zip │ └── starter │ ├── .keep │ └── repos.zip ├── 20-gitflow-workflow ├── .gitignore └── projects │ ├── final │ └── repos.zip │ └── starter │ └── repos.zip ├── 21-forking-workflow └── projects │ ├── final │ └── git-book-fizzbuzz.zip │ └── starter │ └── commit_message.txt ├── LICENCE ├── README.md └── scripts ├── make-codex-branch.sh └── make-codex-subdirectory.sh /.gitignore: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # .gitignore # 3 | ############################################################ 4 | # In theory a lot of this should be in the users' global # 5 | # gitignore files. Cruel experience has shown us that this # 6 | # is not the case. So instead we include lots of guff in # 7 | # here. # 8 | ############################################################ 9 | 10 | 11 | ############################################################ 12 | # macOS # 13 | ############################################################ 14 | 15 | # General 16 | .DS_Store 17 | .AppleDouble 18 | .LSOverride 19 | 20 | # Icon must end with two \r 21 | Icon 22 | 23 | # Thumbnails 24 | ._* 25 | 26 | # Files that might appear in the root of a volume 27 | .DocumentRevisions-V100 28 | .fseventsd 29 | .Spotlight-V100 30 | .TemporaryItems 31 | .Trashes 32 | .VolumeIcon.icns 33 | .com.apple.timemachine.donotpresent 34 | 35 | # Directories potentially created on remote AFP share 36 | .AppleDB 37 | .AppleDesktop 38 | Network Trash Folder 39 | Temporary Items 40 | .apdisk 41 | 42 | 43 | ############################################################ 44 | # Windows # 45 | ############################################################ 46 | 47 | # Windows thumbnail cache files 48 | Thumbs.db 49 | Thumbs.db:encryptable 50 | ehthumbs.db 51 | ehthumbs_vista.db 52 | 53 | # Dump file 54 | *.stackdump 55 | 56 | # Folder config file 57 | [Dd]esktop.ini 58 | 59 | # Recycle Bin used on file shares 60 | $RECYCLE.BIN/ 61 | 62 | # Windows Installer files 63 | *.cab 64 | *.msi 65 | *.msix 66 | *.msm 67 | *.msp 68 | 69 | # Windows shortcuts 70 | *.lnk 71 | 72 | 73 | ############################################################ 74 | # Linux # 75 | ############################################################ 76 | 77 | *~ 78 | 79 | # temporary files which can be created if a process still has a handle open of a deleted file 80 | .fuse_hidden* 81 | 82 | # KDE directory preferences 83 | .directory 84 | 85 | # Linux trash folder which might appear on any partition or disk 86 | .Trash-* 87 | 88 | # .nfs files are created when an open file is removed but is still being accessed 89 | .nfs* 90 | 91 | 92 | 93 | ############################################################ 94 | # SublimeText # 95 | ############################################################ 96 | 97 | # Cache files for Sublime Text 98 | *.tmlanguage.cache 99 | *.tmPreferences.cache 100 | *.stTheme.cache 101 | 102 | # Workspace files are user-specific 103 | *.sublime-workspace 104 | 105 | # Project files should be checked into the repository, unless a significant 106 | # proportion of contributors will probably not be using Sublime Text 107 | # *.sublime-project 108 | 109 | # SFTP configuration file 110 | sftp-config.json 111 | sftp-config-alt*.json 112 | 113 | # Package control specific files 114 | Package Control.last-run 115 | Package Control.ca-list 116 | Package Control.ca-bundle 117 | Package Control.system-ca-bundle 118 | Package Control.cache/ 119 | Package Control.ca-certs/ 120 | Package Control.merged-ca-bundle 121 | Package Control.user-ca-bundle 122 | oscrypto-ca-bundle.crt 123 | bh_unicode_properties.cache 124 | 125 | # Sublime-github package stores a github token in this file 126 | # https://packagecontrol.io/packages/sublime-github 127 | GitHub.sublime-settings 128 | 129 | 130 | ############################################################ 131 | # VSCode # 132 | ############################################################ 133 | 134 | .vscode/* 135 | !.vscode/settings.json 136 | !.vscode/tasks.json 137 | !.vscode/launch.json 138 | !.vscode/extensions.json 139 | *.code-workspace 140 | 141 | # Local History for Visual Studio Code 142 | .history/ 143 | 144 | 145 | ############################################################ 146 | # vim # 147 | ############################################################ 148 | 149 | # Swap 150 | [._]*.s[a-v][a-z] 151 | !*.svg # comment out if you don't need vector files 152 | [._]*.sw[a-p] 153 | [._]s[a-rt-v][a-z] 154 | [._]ss[a-gi-z] 155 | [._]sw[a-p] 156 | 157 | # Session 158 | Session.vim 159 | Sessionx.vim 160 | 161 | # Temporary 162 | .netrwhist 163 | *~ 164 | # Auto-generated tag files 165 | tags 166 | # Persistent undo 167 | [._]*.un~ 168 | 169 | 170 | ############################################################ 171 | # Android # 172 | ############################################################ 173 | 174 | # Built application files 175 | *.apk 176 | *.aar 177 | *.ap_ 178 | *.aab 179 | 180 | # Files for the ART/Dalvik VM 181 | *.dex 182 | 183 | # Java class files 184 | *.class 185 | 186 | # Generated files 187 | bin/ 188 | gen/ 189 | out/ 190 | # Uncomment the following line in case you need and you don't have the release build type files in your app 191 | # release/ 192 | 193 | # Gradle files 194 | .gradle/ 195 | build/ 196 | 197 | # Local configuration file (sdk path, etc) 198 | local.properties 199 | 200 | # Proguard folder generated by Eclipse 201 | proguard/ 202 | 203 | # Log Files 204 | *.log 205 | 206 | # Android Studio Navigation editor temp files 207 | .navigation/ 208 | 209 | # Android Studio captures folder 210 | captures/ 211 | 212 | # IntelliJ 213 | *.iml 214 | .idea/workspace.xml 215 | .idea/tasks.xml 216 | .idea/gradle.xml 217 | .idea/assetWizardSettings.xml 218 | .idea/dictionaries 219 | .idea/libraries 220 | # Android Studio 3 in .gitignore file. 221 | .idea/caches 222 | .idea/modules.xml 223 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 224 | .idea/navEditor.xml 225 | 226 | # Keystore files 227 | # Uncomment the following lines if you do not want to check your keystore files in. 228 | #*.jks 229 | #*.keystore 230 | 231 | # External native build folder generated in Android Studio 2.2 and later 232 | .externalNativeBuild 233 | .cxx/ 234 | 235 | # Google Services (e.g. APIs or Firebase) 236 | # google-services.json 237 | 238 | # Freeline 239 | freeline.py 240 | freeline/ 241 | freeline_project_description.json 242 | 243 | # fastlane 244 | fastlane/report.xml 245 | fastlane/Preview.html 246 | fastlane/screenshots 247 | fastlane/test_output 248 | fastlane/readme.md 249 | 250 | # Version control 251 | vcs.xml 252 | 253 | # lint 254 | lint/intermediates/ 255 | lint/generated/ 256 | lint/outputs/ 257 | lint/tmp/ 258 | # lint/reports/ 259 | 260 | 261 | 262 | ############################################################ 263 | # Xcode. # 264 | ############################################################ 265 | # 266 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 267 | 268 | ## User settings 269 | xcuserdata/ 270 | 271 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 272 | *.xcscmblueprint 273 | *.xccheckout 274 | 275 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 276 | build/ 277 | DerivedData/ 278 | *.moved-aside 279 | *.pbxuser 280 | !default.pbxuser 281 | *.mode1v3 282 | !default.mode1v3 283 | *.mode2v3 284 | !default.mode2v3 285 | *.perspectivev3 286 | !default.perspectivev3 287 | 288 | ## Gcc Patch 289 | /*.gcno 290 | -------------------------------------------------------------------------------- /01-a-crash-course-in-git/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/01-a-crash-course-in-git/projects/challenge/.keep -------------------------------------------------------------------------------- /01-a-crash-course-in-git/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/01-a-crash-course-in-git/projects/final/.keep -------------------------------------------------------------------------------- /01-a-crash-course-in-git/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/01-a-crash-course-in-git/projects/starter/.keep -------------------------------------------------------------------------------- /02-cloning-a-repo/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/02-cloning-a-repo/projects/challenge/.keep -------------------------------------------------------------------------------- /02-cloning-a-repo/projects/challenge/02-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 2 - Challenge Solution 2 | 3 | The goal of this challenge is twofold: 4 | 5 | a. Create a fork of the ideas repository under your own user account on GitHub. 6 | b. Clone the forked repository to your local system. 7 | 8 | This involves a few steps: 9 | 10 | 1. Fork the **ideas** repository under your own personal user account. 11 | 2. Find the clone URL of your new, forked repository. 12 | 3. Clone the forked **ideas** repository to your local system. 13 | 4. Verify that the local clone created successfully. 14 | 5. Bonus: Prove that you’ve cloned the fork of your repo, and not the original repository. 15 | 16 | Here are the steps to follow to complete this challenge: 17 | 18 | Forking the repository: 19 | 20 | - Log in to GitHub with your personal account. 21 | - Go to the ideas repository at https://www.github.com/raywenderlich/ideas. 22 | - Click the "Fork" button on the repository homepage. 23 | - Wait while GitHub creates a fork of the repository. 24 | - When the fork has been created, you’ll be taken to the new repository homepage. 25 | 26 | Cloning the fork: 27 | 28 | - Click the "Clone or download" button, and get the HTTPS URL to clone the repository. 29 | - Go to your command prompt, and navigate to the main MasteringGit directory if you’re not already there. 30 | - run "git clone https://www.github.com//ideas.git" 31 | 32 | Verify the clone created successfully: 33 | 34 | - Navigate into the newly created "ideas" directory with "cd ideas". 35 | - Use "ls" to see that the file structure you expect is there. 36 | 37 | Bonus: Prove you’ve cloned the fork, and not the original 38 | 39 | - This one may take a bit of Googling. The git command "git remote" will help you out here. 40 | - While inside the "ideas" directory, execute the command "git remote -v". 41 | - This will show you the origin of your local clone: https://www.github.com//ideas. 42 | 43 | --- 44 | end of file -------------------------------------------------------------------------------- /02-cloning-a-repo/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/02-cloning-a-repo/projects/final/.keep -------------------------------------------------------------------------------- /02-cloning-a-repo/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/02-cloning-a-repo/projects/starter/.keep -------------------------------------------------------------------------------- /03-committing-your-changes/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/03-committing-your-changes/projects/challenge/.keep -------------------------------------------------------------------------------- /03-committing-your-changes/projects/challenge/03-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 3 - Challenge Solution 2 | 3 | This challenge simply reuses the commands you’ve used in this chapter to accomplish the following tasks: 4 | 5 | 1. Create a new file named **tutorials_ideas.md** inside the **tutorials** directory. 6 | 2. Add a heading to the file: `# Tutorial Ideas` 7 | 3. Populate the file with a few ideas, following the format of the other files, for example, `[ ] Mastering PalmOS`. 8 | 4. Save your changes. 9 | 5. Add those changes to the staging area. 10 | 6. Commit those staged changes with an appropriate message 11 | 12 | Here are the steps I followed to complete this challenge. You may have used slightly different methods to accomplish the same result, but here’s how I did it: 13 | 14 | - Create the new file with the command: touch tutorials/tutorial_ideas.md 15 | 16 | - Edit the files using nano, with the command: nano tutorials/tutorial_ideas.md 17 | 18 | - Added the following content to the file: 19 | 20 | # Tutorial Ideas 21 | 22 | Some tutorial ideas to help us branch out into new areas where no tutorial has gone before: 23 | 24 | [ ] Mastering PalmOS 25 | [ ] COBOL: Not just for Y2K anymore 26 | [ ] AppleTalk by Tutorials: Your road to the information superhighway 27 | 28 | - Saved my changes (in nano, Ctrl + O, Enter, Ctrl + X) 29 | 30 | - Staged my changes with "git add ." 31 | 32 | - Committed my changes with the command: git commit -m "Adding some tutorial ideas" 33 | 34 | - Bonus: To prove to myself that my changes made it there, checked log with the command: git log -p 35 | 36 | Which gave me the following output, which I’ve truncated to the important bits: 37 | 38 | commit 6c88142dc775c4289b764cb9cf2e644274072102 (HEAD -> master) 39 | Author: Chris Belanger 40 | Date: Sat Jan 19 07:16:11 2019 -0400 41 | 42 | Adding some tutorial ideas 43 | 44 | diff --git a/tutorials/tutorial_ideas.md b/tutorials/tutorial_ideas.md 45 | new file mode 100644 46 | index 0000000..a0bde40 47 | --- /dev/null 48 | +++ b/tutorials/tutorial_ideas.md 49 | @@ -0,0 +1,7 @@ 50 | +# Tutorial Ideas 51 | + 52 | +Some tutorial ideas to help us branch out into new areas where no tutorial has gone before: 53 | + 54 | +[ ] Mastering PalmOS 55 | +[ ] COBOL: Not just for Y2K anymore 56 | +[ ] AppleTalk by Tutorials: Your road to the information superhighway 57 | 58 | --- 59 | end of file 60 | 61 | -------------------------------------------------------------------------------- /03-committing-your-changes/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/03-committing-your-changes/projects/final/.keep -------------------------------------------------------------------------------- /03-committing-your-changes/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/03-committing-your-changes/projects/starter/.keep -------------------------------------------------------------------------------- /04-the-staging-area/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/04-the-staging-area/projects/challenge/.keep -------------------------------------------------------------------------------- /04-the-staging-area/projects/challenge/04-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 4 - Challenge Solution 2 | 3 | This challenge simply reuses the commands you’ve used in this chapter to accomplish the following tasks: 4 | 5 | 1. Move the newly added **books/management_book_ideas.md** to the **website** directory with `git mv`. 6 | 2. You’ve changed your mind and don’t want **management_book_ideas.md** anymore, so remove that file completely. 7 | 3. But now you’re having second thoughts: maybe you _do_ have some good ideas about management. Restore that file to its original location in the **books** directory. 8 | 9 | Again, it’s worth your while to execute "git status" after each change, to see exactly what Git is going at each step. It’s a great way to get your bearings in your early days with Git. 10 | 11 | Here are the steps I followed to complete this challenge. You may have used slightly different methods to accomplish the same result, but here’s how I did it: 12 | 13 | - Move the file with "git mv books/management_book_ideas.md website/" 14 | 15 | - Next, if you try to do "git rm website/management_book_ideas.md" to delete the file, Git will give you an error: 16 | 17 | error: the following file has changes staged in the index: 18 | website/management_book_ideas.md 19 | (use --cached to keep the file, or -f to force removal) 20 | 21 | - So simply add the "-f" option to the end of that command to force removal, and try it again: "git rm website/management_book_ideas.md -f". Git will replace the staged change of renaming the file, with the new change of deleting the file. 22 | 23 | - To undo that staged change, simply revert your staged changes with "git reset HEAD books/management_book_ideas.md". 24 | 25 | - Then, to restore the file, execute "git checkout HEAD books/management_book_ideas.md" to get the original version of that file back from the repository. 26 | 27 | --- 28 | end of file 29 | 30 | -------------------------------------------------------------------------------- /04-the-staging-area/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/04-the-staging-area/projects/final/.keep -------------------------------------------------------------------------------- /04-the-staging-area/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/04-the-staging-area/projects/starter/.keep -------------------------------------------------------------------------------- /05-ignoring-files/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/05-ignoring-files/projects/challenge/.keep -------------------------------------------------------------------------------- /05-ignoring-files/projects/challenge/05-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 5 - Challenge Solution 2 | 3 | This challenge simply asks you to grab the contents of a file in GitHub and copy it into your global **.gitignore** with the following steps: 4 | 5 | 1. Navigate to [https://github.com/github/gitignore/tree/master/Global](https://github.com/github/gitignore/tree/master/Global). 6 | 2. Find the correct **.gitignore** for your own operating system. 7 | 3. Take the contents of that OS-specific **.gitignore**, and add it to your own global **.gitignore**. 8 | 9 | Here are the steps I followed to complete this challenge. You may have used slightly different methods to accomplish the same result, but here’s how I did it: 10 | 11 | - Navigate to [https://github.com/github/gitignore/tree/master/Global](https://github.com/github/gitignore/tree/master/Global) in a browser. 12 | - Click on the appropriate global .gitignore file for your operating system. I’m on a Mac, so I’ll use the macOS.gitignore file. 13 | - Copy the contents of this file and press Command + C (Control + C on a Windows machine) to copy it to your clipboard 14 | - Return to your terminal program and edit the ".gitignore_global" file you created in the chapter. 15 | - Paste the contents of the file into "gitignore_global" and save your changes. 16 | 17 | That’s it! Now, Git won’t track any of these files in any new repositories that you create on your local system. 18 | 19 | --- 20 | end of file 21 | -------------------------------------------------------------------------------- /05-ignoring-files/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/05-ignoring-files/projects/final/.keep -------------------------------------------------------------------------------- /05-ignoring-files/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/05-ignoring-files/projects/starter/.keep -------------------------------------------------------------------------------- /06-git-log-and-viewing-history/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/06-git-log-and-viewing-history/projects/challenge/.keep -------------------------------------------------------------------------------- /06-git-log-and-viewing-history/projects/challenge/06-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 6 - Challenge Solution 2 | 3 | Challenge 1: Show all the details of commits that mark items as “done” 4 | 5 | For this challenge, you need to find all of the commits where items have been ticked off as “done”; that is, ones that have an “x” inside the brackets, like so: 6 | 7 | `[x]` 8 | 9 | You’ll need to search for the above string, and you’ll need to use an option to not only show the basic commit details, but also show the contents of the changeset of the commit. 10 | 11 | To do this, use the search flag "-S" with git log, and also include the "-p" flag to see the contents of each commit: 12 | 13 | 14 | git log -s"[x]" -p 15 | 16 | 17 | 18 | Challenge 2: Find all the commits with messages that mention “streaming” 19 | 20 | You want to search through the commit **messages** to find where you or someone else has used the term “streaming” in the commit message itself, not necessarily in the content of the commit. Tip: What was that strangely named command you learned about earlier in this chapter? 21 | 22 | Right, you want to use "--grep" to go through the commit messages, instead of "-S" to search the contents: 23 | 24 | 25 | git log --grep="streaming" 26 | 27 | 28 | 29 | Challenge 3: Get a detailed history of the videos directory 30 | 31 | For this challenge, you need to show everything that’s happened inside the **videos** directory, as far as Git’s concerned. But, once again, the basic information about the commit is not enough. You also need to show the full details about that diff. So you’ll tag a familiar option on to the end of the command... or can you? 32 | 33 | So you can pull up the list of changes that have happened with a basic filter to limit the history to just the contents of /videos: 34 | 35 | 36 | git log -- videos/ 37 | 38 | 39 | But that's not quite what you want to do - this shows you the basic commit information. You want the detailed information of each commit. 40 | 41 | Your first instinct might be to put the "-p" flag on the end, but wait — you can't do that, since you've already used "--" in your command, and you can't use basic flags after "--". 42 | 43 | So instead, you need to put "-p" just after "git log": 44 | 45 | 46 | git log -p -- videos/ 47 | 48 | 49 | 50 | Challenge 4: Find detailed information about all commits that contain “iOS 13” 51 | 52 | In this final challenge, you need to find the commits whose diffs contain the term “iOS 13.” This sounds similar to Challenge 1 above, but if you try to use the same command as you did in that challenge, you won’t find any results. But trust me, there is at least one result in there. Tip: Did you remember to search “all” of the repository? 53 | 54 | The secret here is that you need to look beyond any history in your current branch, and tell Git to also consider other branches. So you'll need the "--all" flag in there: 55 | 56 | git log -p --all -S"iOS 13" 57 | 58 | -- 59 | end of file -------------------------------------------------------------------------------- /06-git-log-and-viewing-history/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/06-git-log-and-viewing-history/projects/final/.keep -------------------------------------------------------------------------------- /06-git-log-and-viewing-history/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/06-git-log-and-viewing-history/projects/starter/.keep -------------------------------------------------------------------------------- /07-branching/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/07-branching/projects/challenge/.keep -------------------------------------------------------------------------------- /07-branching/projects/challenge/07-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 7 - Challenge Solution 2 | 3 | 1. Create a temporary branch with the name of **newBranch**. 4 | 5 | 6 | git branch newBranch 7 | 8 | 9 | 10 | 2. Switch to that branch. 11 | 12 | git checkout newBranch 13 | 14 | 15 | 16 | 3. Use the `touch` command to create an empty **README.md** file in the root directory of your project. 17 | 18 | 19 | touch README.md 20 | 21 | 22 | 4. Add that new **README.md** file to the staging area. 23 | 24 | 25 | git add README.md 26 | 27 | 28 | 5. Commit that change with an appropriate message. 29 | 30 | 31 | git commit -m "Adding README.md" 32 | 33 | 34 | 6. Checkout the **master** branch. 35 | 36 | 37 | git checkout master 38 | 39 | 40 | 7. Delete **newBranch** — but Git won’t let you delete this branch in its current state. Why? 41 | 42 | First, try the following: 43 | 44 | 45 | git branch -d newBranch 46 | 47 | 48 | Git responds with: 49 | 50 | 51 | error: The branch 'newBranch' is not fully merged. 52 | If you are sure you want to delete it, run 'git branch -D newBranch'. 53 | 54 | 55 | 8. Follow the suggestion that Git gives you to see if you can delete this branch. 56 | 57 | 58 | git branch -D newBranch 59 | 60 | --- 61 | end of file -------------------------------------------------------------------------------- /07-branching/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/07-branching/projects/final/.keep -------------------------------------------------------------------------------- /07-branching/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/07-branching/projects/starter/.keep -------------------------------------------------------------------------------- /08-syncing-with-a-remote/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/08-syncing-with-a-remote/projects/challenge/.keep -------------------------------------------------------------------------------- /08-syncing-with-a-remote/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/08-syncing-with-a-remote/projects/final/.keep -------------------------------------------------------------------------------- /08-syncing-with-a-remote/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/08-syncing-with-a-remote/projects/starter/.keep -------------------------------------------------------------------------------- /09-creating-a-repo/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/09-creating-a-repo/projects/challenge/.keep -------------------------------------------------------------------------------- /09-creating-a-repo/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/09-creating-a-repo/projects/final/.keep -------------------------------------------------------------------------------- /09-creating-a-repo/projects/starter/mastering-git-web/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Razeware, LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /09-creating-a-repo/projects/starter/mastering-git-web/README.md: -------------------------------------------------------------------------------- 1 | # mastering-git-web 2 | 3 | This repository houses a proposed website for the Mastering Git book. 4 | 5 | Contact: [@crispytwit](https://twitter.com/crispytwit) 6 | -------------------------------------------------------------------------------- /09-creating-a-repo/projects/starter/mastering-git-web/css/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | 5 | body { 6 | margin: 0; 7 | font-family: Georgia, serif; 8 | } 9 | 10 | /* Style the side navigation */ 11 | .sidenav { 12 | height: 100%; 13 | width: 200px; 14 | position: fixed; 15 | z-index: 1; 16 | top: 0; 17 | left: 0; 18 | background-color: #111155; 19 | overflow-x: hidden; 20 | } 21 | 22 | 23 | /* Side navigation links */ 24 | .sidenav a { 25 | color: white; 26 | padding: 16px; 27 | text-decoration: none; 28 | display: block; 29 | } 30 | 31 | /* Change color on hover */ 32 | .sidenav a:hover { 33 | background-color: #ddd; 34 | color: black; 35 | } 36 | 37 | /* Style the content */ 38 | .content { 39 | margin-left: 200px; 40 | padding-left: 20px; 41 | } 42 | 43 | blockquote { 44 | background: #f9f9f9; 45 | border-left: 10px solid #ccc; 46 | margin: 1.5em 10px; 47 | padding: 0.5em 10px; 48 | quotes: "\201C""\201D""\2018""\2019"; 49 | } 50 | 51 | blockquote:before { 52 | color: #ccc; 53 | content: open-quote; 54 | font-size: 4em; 55 | line-height: 0.1em; 56 | margin-right: 0.25em; 57 | vertical-align: -0.4em; 58 | } 59 | 60 | blockquote p { 61 | display: inline; 62 | } -------------------------------------------------------------------------------- /09-creating-a-repo/projects/starter/mastering-git-web/images/SFR_b+w_-_penguin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/09-creating-a-repo/projects/starter/mastering-git-web/images/SFR_b+w_-_penguin.jpg -------------------------------------------------------------------------------- /09-creating-a-repo/projects/starter/mastering-git-web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 |
14 |

Mastering Git

15 |

From first steps to becoming a Git master

16 | 17 | 18 |

What people are saying about Mastering Git

19 |
Truly one of the classics of our time. Gang of Four, look out!
20 |
21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /10-merging/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/10-merging/projects/challenge/.keep -------------------------------------------------------------------------------- /10-merging/projects/challenge/10-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 10 - Challenge Solution 2 | 3 | This challenge asks you to create a branch, make some modifications on that branch, and force Git to not perform a fast-forward merge. The high-level steps for this task are: 4 | 5 | 1. Ensure you’re on the `master` branch. 6 | 2. Create a branch named `contact-details`. 7 | 3. Switch to that branch. 8 | 4. Edit the README.md file and add the following text to the end of the file: "Contact: support@razeware.com". 9 | 5. Save your edits to the file. 10 | 6. Stage your changes. 11 | 7. Commit your changes with an appropriate commit message, such as "Adding README contact information". 12 | 8. Switch back to the `master` branch. 13 | 9. Pull up the graph of the repository, and don’t forget to use the `--all` option to see history of all branches. Make note of how `master` and `contact-details` look on this graph. 14 | 10. Merge in the changes from `contact-details`, using the `--no-ff` option. 15 | 11. Enter something appropriate in the merge message in Vim when prompted. Use the cheatsheet above to help you navigate through Vim if necessary. 16 | 12. Pull up the graph of the repository again. How can you tell that this is a merge commit, and not a fast-forward commit? 17 | 18 | Here are the steps I followed to complete this challenge. You may have used slightly different methods to accomplish the same result, but here’s how I did it: 19 | 20 | - git checkout master 21 | - git branch -b contact-details 22 | - There’s no need to explicitly switch to that branch; git branch -b does this for you 23 | - I edited README.md in nano and saved my changes. 24 | - git add README.md 25 | - git commit -m "Adding README contact information" 26 | - git checkout master 27 | - git log --graph --oneline --all 28 | - This shows me the following: 29 | 30 | * 75e1886 (contact-details) Adding README contact information 31 | * 78eefc6 (HEAD -> master, readme-updates) Adding more detail to the README file 32 | * 55fb2dc Merge branch 'clickbait' 33 | |\ 34 | | * e69a76a (origin/clickbait, clickbait) Adding suggestions from Mic 35 | 36 | 37 | - git merge contact-details --no-ff 38 | - git log --graph --oneline --all 39 | - This shows me the following: 40 | 41 | * f5c54f0 (HEAD -> master) Merge branch 'contact-details' 42 | |\ 43 | | * 75e1886 (contact-details) Adding README contact information 44 | |/ 45 | * 78eefc6 (readme-updates) Adding more detail to the README file 46 | * 55fb2dc Merge branch 'clickbait' 47 | |\ 48 | | * e69a76a (origin/clickbait, clickbait) Adding suggestions from Mic 49 | 50 | You can tell this is a merge commit, since Git created a new commit (f5c54f0) to merge the changes from the contact-details branch (75e1886). Plus the graphical representation shows the branch structure. 51 | 52 | Had you chosen to *not* create a merge commit, and instead do a fast-forward commit, your repository graph would have looked like the following: 53 | 54 | * 75e1886 (HEAD -> master, contact-details) Adding README contact information 55 | * 78eefc6 (readme-updates) Adding more detail to the README file 56 | * 55fb2dc Merge branch 'clickbait' 57 | |\ 58 | | * e69a76a (origin/clickbait, clickbait) Adding suggestions from Mic 59 | 60 | --- 61 | end of file 62 | 63 | 64 | -------------------------------------------------------------------------------- /10-merging/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/10-merging/projects/final/.keep -------------------------------------------------------------------------------- /10-merging/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/10-merging/projects/starter/.keep -------------------------------------------------------------------------------- /11-how-does-git-actually-work/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/11-how-does-git-actually-work/projects/challenge/.keep -------------------------------------------------------------------------------- /11-how-does-git-actually-work/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/11-how-does-git-actually-work/projects/final/.keep -------------------------------------------------------------------------------- /11-how-does-git-actually-work/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/11-how-does-git-actually-work/projects/starter/.keep -------------------------------------------------------------------------------- /12-merge-conflicts/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/12-merge-conflicts/projects/challenge/.keep -------------------------------------------------------------------------------- /12-merge-conflicts/projects/challenge/13-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 13 — Challenge Solution 2 | 3 | This challenge simply reuses the commands you’ve already learned in this chapter to accomplish the following tasks: 4 | 5 | - Checkout the `xReadmeUpdates` branch and look at the README.md file to see Xanthe’s version. 6 | - Checkout `master`, since this is the destination for your merge. 7 | - Resolve any merge conflicts by hand. 8 | - Stage your changes. 9 | - Commit your changes. 10 | - Delete the `xReadmeUpdates` branch. 11 | 12 | Here are the steps I followed to complete this challenge; your solution may be slightly different: 13 | 14 | 1. Checkout the branch with the command: git checkout xReadmeUpdates 15 | 2. Look at the file with the following command: cat README.md. 16 | 3. I can see that the file is pretty basic, with the simple information about the library and page, and some contact information below. 17 | 4. Switch to the master branch with the command: git checkout master 18 | 5. Run the merge with the command: git merge xReadmeUpdates 19 | 6. Git tells me there’s a merge conflict, so I open up README.md in a text editor. 20 | 7. I see the following contents in README.md: 21 | 22 | 23 | # magicSquareJS 24 | 25 | magicSquareJS is a simple JavaScript library and HTML page that generates and validates magic squares. 26 | 27 | For more information about magic squares, check out [Wikipedia](https://en.wikipedia.org/wiki/Magic_square). 28 | 29 | <<<<<<< HEAD 30 | # LICENSE 31 | 32 | magicSquareJS is available under the Apache 2.0 license. 33 | 34 | # Maintainers 35 | 36 | This project is maintained by teamWYXZ: 37 | - Will 38 | - Yasmin 39 | - Xanthe 40 | - Zack 41 | ||||||| merged common ancestors 42 | ======= 43 | ## Contact Info 44 | 45 | For info on this project, please contact [Xanthe](mailto:xanthe@example.com). 46 | >>>>>>> xReadmeUpdates 47 | 48 | 49 | 8. It appears someone has added license and maintainer information along the way, and Xanthe has added the contact information in a separate branch. Git sees this as a conflict because both authors added the text at the exact same place: the end of the file. Git doesn’t know anything about the semantics of this file, so it bails and asks you to manually correct the conflict. 50 | 9. I want to keep both sets of changes, so I remove the following line: <<<<<<< HEAD 51 | 10. I also remove: ||||||| merged common ancestors 52 | 11. I also remove: ======= 53 | 12. I also remove: >>>>> xReadmeUpdates 54 | 13. I save my work and exit out of the text editor. 55 | 14. I add my changes with the command: git add README.md 56 | 15. I commit my changes with the command: git commit 57 | 16. I use ":wq" to exit out of Vim and accept the default merge commit message. 58 | 17. I delete the xReadmeUpdates branch with the command: git branch -d xReadmeUpdates 59 | 60 | --- 61 | end of file 62 | -------------------------------------------------------------------------------- /12-merge-conflicts/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/12-merge-conflicts/projects/final/.keep -------------------------------------------------------------------------------- /12-merge-conflicts/projects/final/magicSquareJS.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/12-merge-conflicts/projects/final/magicSquareJS.zip -------------------------------------------------------------------------------- /12-merge-conflicts/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/12-merge-conflicts/projects/starter/.keep -------------------------------------------------------------------------------- /12-merge-conflicts/projects/starter/magicSquareJS.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/12-merge-conflicts/projects/starter/magicSquareJS.zip -------------------------------------------------------------------------------- /13-stashes/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/13-stashes/projects/challenge/.keep -------------------------------------------------------------------------------- /13-stashes/projects/challenge/11-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 11 - Challenge Solution 2 | 3 | This challenge has you diving into the Git documentation a bit, to solve the following problem: 4 | 5 | Execute `git stash list` and you’ll see there’s still a stash there. But you popped that stash, didn’t you? Of course you did. 6 | 7 | Your challenge is twofold, and may require a little dive into the Git documentation: 8 | 9 | 1. Explain why there’s still a stash in the stack, even though you executed `git stash pop`. 10 | 2. Remove the remaining entry from the stash without using `git stash pop` or `git stash clear`. There’s one more way to remove entries from the stack with `git stash` — what is it? 11 | 12 | To answer #1, you executed "git stash pop" for sure, but Git encountered a conflict when trying to merge your stash. So Git immediately bailed on the stash removal option, and left the merge conflicts for you to clean up. So Git leaves the stash on the stack, just in case you wanted to roll back. If Git removed the stash from the stack before you had a chance to roll back, you’d be in a weird indeterminate state where you had a conflict and your saved stash would have vanished. 13 | 14 | To answer #2, you’ll need to dig into the Git documentation just a little. "man git stash" will do it for you command-line diehards, but you can also search up the git stash documentation on the web. 15 | 16 | Turns out there’s another way to remove stashes from the stack: "git stash drop ". If you look back at the output from "git stash pop", you’ll see that the last line of output reads like the following: 17 | 18 | "Dropped refs/stash@{0} (fca102bbfc2e4dc51264ae46211f95164ac2c933)" 19 | 20 | So popping a stash is very much like a combination "apply" and then "drop". "git stash drop" is useful for cleaning up your stash stack, should you have a lot on there. But if your stash stack gets too big, then you’re invoking a lot of overhead to manage that stash stack. My preference is to keep my stash stacks brief and as short-lived as possible. 21 | 22 | --- 23 | end of file 24 | 25 | -------------------------------------------------------------------------------- /13-stashes/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/13-stashes/projects/final/.keep -------------------------------------------------------------------------------- /13-stashes/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/13-stashes/projects/starter/.keep -------------------------------------------------------------------------------- /14-demystifying-rebasing/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/14-demystifying-rebasing/projects/challenge/.keep -------------------------------------------------------------------------------- /14-demystifying-rebasing/projects/challenge/14-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 14 - Challenge Solution 2 | 3 | Your challenge is: 4 | 5 | You’ve discovered that Zach has also been doing a bit of refactoring on the **zValidator** branch with the range checking function: 6 | 7 | ```none 8 | | * 136dc26 (zValidator) Refactoring the range checking function 9 | |/ 10 | * 665575c util02: Adding function to check the range of values 11 | ``` 12 | 13 | Your challenge is to rebase the work you’ve done on the wValidator branch on top of the zValidator branch. Again, the shared context here, and the limited scope of the changes, means you don’t need a merge commit. 14 | 15 | Once you’ve rebased wValidator on top of zValidator, delete both the zValidator and xValidator branches, as you’re done with them. Git might complain when you try to delete the branches. Explain why this is, and then figure out how to force Git to do it anyway. 16 | 17 | Here are the steps to follow to complete this challenge: 18 | 19 | - Ensure you are on the wValidator branch with “git checkout wValidator”. 20 | - Execute “git rebase zValidator”; this should complete without conflict. 21 | - Execute “git branch -d zValidator”; this should complete without issues. 22 | - Execute “git branch -d xValidator”, but Git stops you with the following error: 23 | 24 | error: The branch 'xValidator' is not fully merged. 25 | If you are sure you want to delete it, run 'git branch -D xValidator'. 26 | 27 | This is because the xValidator branch contains commits that Git doesn’t recognized as merged, due to the rebasing work you did earlier. 28 | 29 | - To force Git to delete the branch, execute “git branch -D xValidator”. 30 | 31 | --- 32 | end of file -------------------------------------------------------------------------------- /14-demystifying-rebasing/projects/challenge/magicSquareJS-challenge.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/14-demystifying-rebasing/projects/challenge/magicSquareJS-challenge.zip -------------------------------------------------------------------------------- /14-demystifying-rebasing/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/14-demystifying-rebasing/projects/final/.keep -------------------------------------------------------------------------------- /14-demystifying-rebasing/projects/final/magicSquareJS-final.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/14-demystifying-rebasing/projects/final/magicSquareJS-final.zip -------------------------------------------------------------------------------- /14-demystifying-rebasing/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/14-demystifying-rebasing/projects/starter/.keep -------------------------------------------------------------------------------- /14-demystifying-rebasing/projects/starter/magicSquareJS-starter.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/14-demystifying-rebasing/projects/starter/magicSquareJS-starter.zip -------------------------------------------------------------------------------- /15-rebasing-to-rewrite-history/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/15-rebasing-to-rewrite-history/projects/challenge/.keep -------------------------------------------------------------------------------- /15-rebasing-to-rewrite-history/projects/challenge/15-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 15 - Challenge Solution 2 | 3 | Your challenge has two parts. The first: 4 | 5 | You’d like to squash all of the `check0x` commits into one tidy commit. And although you _could_ follow the pattern above, where you first rearrange the commits in one rebase, and then perform the squash in a separate rebase. 6 | 7 | But you can do this all in one rebase pass: 8 | 9 | 1. Figure out what your base ancestor is for the rebase. 10 | 2. Start an interactive rebase operation. 11 | 3. Reorder the `check0x` commits. 12 | 4. Change the `pick` rebase script command for `squash`, on all commits from the `check02` commit down to and including the `Refactoring the main check function` commit. 13 | 5. Save your work in Vim and exit. 14 | 6. Create a commit message in Vim for the squash operation. 15 | 7. Take a look at your Git log to see the changes you’ve made. 16 | 17 | Here’s how I solved this: 18 | 19 | 1. Execute "git log --oneline" to see the commit history. Again, it makes sense to rebase on top of 69670e7 as the ancestor commit. 20 | 2. Start the interactive rebase with "git rebase -i 69670e7" 21 | 3. Use "dd" and "p" to move the lines in the rebase script around to get all of the check01 to check04 lines together. 22 | 4. Change the check02, check03, check04, Removing TODO and Refactoring the main check function commands from pick to squash. 23 | 5. Save your changes with "Escape", then ":wq", then "Enter". 24 | 6. Once you’re back into Vim to create the commit message for the squash, use "dG" to clear the buffer, press "i" to enter Insert mode, and set the message to "Creating the magic square validation function". Again, "Escape", then ":wq", then "Enter" to save your work and exit Vim. 25 | 7. Pull up your log with "git log --oneline" and you’ll see your squashed commit: 26 | 27 | * d6a095e (wValidator) Updates to README.md 28 | * 32cb912 Creating the magic square validation function 29 | * 926a485 Creating utility functions for magic square validation 30 | 31 | Nice and tidy! 32 | 33 | The second challenge: 34 | 35 | Now that you’ve squashed your work down to just a few commits, it’s time to get wValidator back into the `master` branch. It’s likely your first instinct is to merge `wValidator` back to `master`, but you’re a rebase guru by this point, so you’ll rebase those commits on top of `master` instead: 36 | 37 | 1. Ensure you’re on the wValidator branch. 38 | 2. Execute `git rebase` with `master` as your rebase target. 39 | 3. Crud — a conflict. Open README.md and resolve the conflict to preserve your changes, and the changes to the `## Contact` section. 40 | 4. Save your work. 41 | 5. Stage those changes with `git add README.md`. 42 | 6. Continue the rebase with `git rebase --continue`. 43 | 7. Check the log to see where `master` points and where `wValidator` points. 44 | 8. Check out the `master` branch. 45 | 9. Execute `git merge` for `wValidator`. What is special about this merge that lets you avoid a merge commit? 46 | 10. Delete the `wValidator` branch. 47 | 48 | 49 | Here’s how I solved this challenge: 50 | 51 | 1. "git branch wValidator" 52 | 2. "git rebase master" to rebase the current branch on top of master. 53 | 3. I’ve got a conflict in README.md. So I open up that file, and see the following issue: 54 | 55 | # Maintainers 56 | 57 | This project is maintained by teamWYXZC: 58 | - Will 59 | - Yasmin 60 | - Xanthe 61 | - Zack 62 | <<<<<<< HEAD 63 | ## Contact Info 64 | 65 | For info on this project, please contact [Xanthe](mailto:xanthe@example.com). 66 | ||||||| merged common ancestors 67 | ======= 68 | - Chris 69 | >>>>>>> Updates to README.md 70 | 71 | Ah, OK -- the earlier addition of the Contact section conflicts with my addition of "-Chris". I just fix up the file, preserving both sections, so it looks like this: 72 | 73 | # Maintainers 74 | 75 | This project is maintained by teamWYXZC: 76 | - Will 77 | - Yasmin 78 | - Xanthe 79 | - Zack 80 | - Chris 81 | 82 | ## Contact Info 83 | 84 | For info on this project, please contact [Xanthe](mailto:xanthe@example.com). 85 | 86 | 4. I save my changes, and exit. 87 | 5. Stage those changes with `git add README.md`. 88 | 6. Continue the rebase with `git rebase --continue`. 89 | 7. If I execute "git log --all --decorate --oneline --graph" I see the following: 90 | 91 | * d6a095e (HEAD -> wValidator) Updates to README.md 92 | * 32cb912 Creating the magic square validation function 93 | * 926a485 Creating utility functions for magic square validation 94 | | * edfcbf7 (xUtils) Starting work on the contributors section 95 | | * d71ee79 Adding a reference to the generator script 96 | | * da7d366 Importing the new scripts onto the html page 97 | | * f12aa4f Adding function to check whether Square is magic 98 | | * 92b11c0 Adding export to string to Square 99 | | * 5758f59 Adding Square construction methods 100 | | * 81a2bf2 Render a 2D array to a string 101 | | * a33f5f7 Extract an array from a string 102 | | * 49de6d7 Adding array generation utils 103 | | | * 7086b93 (refs/stash) On master: Tools version 104 | | | |\ 105 | | |/ / 106 | |/| | 107 | | | * ac71a22 index on master: b336b31 Merge branch 'xReadmeUpdates' 108 | | |/ 109 | |/| 110 | * | b336b31 (master) Merge branch 'xReadmeUpdates' 111 | |\ \ 112 | | * | 9df03be Adding contact details to README 113 | * | | 7fb65ff Merge branch 'zIntegration' 114 | 115 | The wValidator branch is at the tip of the log, and waaaay back in history is the actual "master" label. 116 | 117 | Now you can merge master and wValidator. Remember, rebasing simply replays the commits on top of the new base; it doesn’t move the labels around. That’s why you need to merge here. 118 | 119 | 8. "git checkout master" 120 | 9. "git merge wValidator" 121 | 122 | Git responds with : 123 | 124 | Updating b336b31..d6a095e 125 | Fast-forward 126 | README.md | 7 ++++++- 127 | js/magic_square/validator.js | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 128 | 2 files changed, 94 insertions(+), 3 deletions(-) 129 | 130 | Aha - a fast-forward merge. That’s what’s special about this. Remember, a fast-forward merge can happen when there is nothing to merge, and a branch label can simply be moved along to the tip of the merging branch. 131 | 132 | 10. Now that the merge has completed, use "git branch -d wValidator" to delete the branch. 133 | 134 | --- 135 | end of file -------------------------------------------------------------------------------- /15-rebasing-to-rewrite-history/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/15-rebasing-to-rewrite-history/projects/final/.keep -------------------------------------------------------------------------------- /15-rebasing-to-rewrite-history/projects/final/magicSquareJS-final.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/15-rebasing-to-rewrite-history/projects/final/magicSquareJS-final.zip -------------------------------------------------------------------------------- /15-rebasing-to-rewrite-history/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/15-rebasing-to-rewrite-history/projects/starter/.keep -------------------------------------------------------------------------------- /15-rebasing-to-rewrite-history/projects/starter/magicSquareJS-starter.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/15-rebasing-to-rewrite-history/projects/starter/magicSquareJS-starter.zip -------------------------------------------------------------------------------- /16-gitignore-after-the-fact/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/16-gitignore-after-the-fact/projects/challenge/.keep -------------------------------------------------------------------------------- /16-gitignore-after-the-fact/projects/challenge/16-challenge.txt: -------------------------------------------------------------------------------- 1 | Chapter 16 — Challenge Solution 2 | 3 | This challenge is rather straightforward: 4 | 5 | Go back and remove all traces of **IGNORE_ME** from your repository. 6 | 7 | You previously removed all traces of **IGNORE_ME** from your repository, but that took you two steps. The challenge here is to do that in one single command: 8 | 9 | - Use `git filter-branch` 10 | - Use `--index-filter` to rewrite the index 11 | - You can use a similar `git rm` command, but remember, this time, you’re filtering on a different file. 12 | - Use `--prune-empty` to remove any empty commits. 13 | - Remember that you want to apply this to all commits, starting at `HEAD` and going backwards. 14 | - You’ll need to use `-f` to force this `filter-branch` operation, since you’ve already done a `filter-branch` and Git has stored a backup of that operation for you. 15 | 16 | Quite simply, you can reuse almost the same command you did to remove all traces of the SECRETS file: 17 | 18 | git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch -- IGNORE_ME' --prune-empty HEAD 19 | 20 | The only difference here is that you’ve run the "git rm" command against IGNORE_ME, and you’ve added the "--prune-empty" option as well. 21 | 22 | --- 23 | end of file 24 | -------------------------------------------------------------------------------- /16-gitignore-after-the-fact/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/16-gitignore-after-the-fact/projects/final/.keep -------------------------------------------------------------------------------- /16-gitignore-after-the-fact/projects/final/magicSquareJS-final.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/16-gitignore-after-the-fact/projects/final/magicSquareJS-final.zip -------------------------------------------------------------------------------- /16-gitignore-after-the-fact/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/16-gitignore-after-the-fact/projects/starter/.keep -------------------------------------------------------------------------------- /16-gitignore-after-the-fact/projects/starter/magicSquareJS-starter.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/16-gitignore-after-the-fact/projects/starter/magicSquareJS-starter.zip -------------------------------------------------------------------------------- /17-many-faces-of-undo/projects/challenge/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/17-many-faces-of-undo/projects/challenge/.keep -------------------------------------------------------------------------------- /17-many-faces-of-undo/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/17-many-faces-of-undo/projects/final/.keep -------------------------------------------------------------------------------- /17-many-faces-of-undo/projects/final/magicSquareJS-final.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/17-many-faces-of-undo/projects/final/magicSquareJS-final.zip -------------------------------------------------------------------------------- /17-many-faces-of-undo/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/17-many-faces-of-undo/projects/starter/.keep -------------------------------------------------------------------------------- /17-many-faces-of-undo/projects/starter/magicSquareJS-starter.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/17-many-faces-of-undo/projects/starter/magicSquareJS-starter.zip -------------------------------------------------------------------------------- /18-centralized-workflow/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/18-centralized-workflow/projects/final/.keep -------------------------------------------------------------------------------- /18-centralized-workflow/projects/final/repos.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/18-centralized-workflow/projects/final/repos.zip -------------------------------------------------------------------------------- /18-centralized-workflow/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/18-centralized-workflow/projects/starter/.keep -------------------------------------------------------------------------------- /18-centralized-workflow/projects/starter/repos.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/18-centralized-workflow/projects/starter/repos.zip -------------------------------------------------------------------------------- /19-feature-branch-workflow/projects/final/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/19-feature-branch-workflow/projects/final/.keep -------------------------------------------------------------------------------- /19-feature-branch-workflow/projects/final/repos.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/19-feature-branch-workflow/projects/final/repos.zip -------------------------------------------------------------------------------- /19-feature-branch-workflow/projects/starter/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/19-feature-branch-workflow/projects/starter/.keep -------------------------------------------------------------------------------- /19-feature-branch-workflow/projects/starter/repos.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/19-feature-branch-workflow/projects/starter/repos.zip -------------------------------------------------------------------------------- /20-gitflow-workflow/.gitignore: -------------------------------------------------------------------------------- 1 | projects/starter/repos/ 2 | .vscode 3 | -------------------------------------------------------------------------------- /20-gitflow-workflow/projects/final/repos.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/20-gitflow-workflow/projects/final/repos.zip -------------------------------------------------------------------------------- /20-gitflow-workflow/projects/starter/repos.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/20-gitflow-workflow/projects/starter/repos.zip -------------------------------------------------------------------------------- /21-forking-workflow/projects/final/git-book-fizzbuzz.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodecocodes/git-materials/cb97de23625f25d0f76032b112e8551d00471685/21-forking-workflow/projects/final/git-book-fizzbuzz.zip -------------------------------------------------------------------------------- /21-forking-workflow/projects/starter/commit_message.txt: -------------------------------------------------------------------------------- 1 | Fix bug in which alternate divisors were not used 2 | 3 | This commit updates the code in the fizzbuzz_for_num method to 4 | start using the fizz_divisor and buzz_divisor parameters that 5 | were added to the method signature in a previous commit 6 | 7 | Verified the fix by running existing tests in test_fizzbuzz.py 8 | which were prevously failing and now are all passing 9 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Razeware LLC 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mastering Git: Materials 2 | 3 | > **NOTE**: This book has now been deprecated. You can still learn about `git` in the two new git books: **[Git Apprentice](https://www.raywenderlich.com/books/git-apprentice)** and **[Advanced Git](https://www.raywenderlich.com/books/advanced-git)**. 4 | 5 | This repo contains all the downloadable materials and projects associated with the **Mastering Git** from [raywenderlich.com](https://www.raywenderlich.com). 6 | 7 | Each edition has its own branch, named `editions/[EDITION]`. The default branch for this repo is for the most recent edition. 8 | 9 | ## Release History 10 | 11 | | Branch | Edition | Release Date | 12 | | -------------------------------------------------------------------------------- |:-------:|:------------:| 13 | | [editions/1.0](https://github.com/raywenderlich/git-materials/tree/editions/1.0) | 1.0 | 2020-08-24 | 14 | 15 | -------------------------------------------------------------------------------- /scripts/make-codex-branch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Need one and only one parameter 4 | if [ $# -ne 1 ]; then 5 | echo "Usage: $0 " 6 | echo "No spaces or such funny characters are allowed." 7 | exit 1 8 | fi 9 | 10 | # Make sure we're inside a git directory 11 | git status >/dev/null 2>&1 12 | if [ $? -ne 0 ]; then 13 | echo "error: run this script from inside a git repository" 14 | exit 1 15 | fi 16 | 17 | BRANCH=`git rev-parse --abbrev-ref HEAD` 18 | 19 | isEdition=`expr "$BRANCH" : 'editions'` 20 | 21 | if [ $isEdition -ne 8 ]; then 22 | echo "WARNING - you're starting a new branch from $BRANCH" 23 | echo "That doesn't look like an editions/x.x branch!" 24 | read -p "Hit Ctrl-C to cancel, or RETURN to continue" choice 25 | fi 26 | 27 | git checkout -b $1 28 | git checkout $BRANCH 29 | 30 | echo Added branch for "$1". 31 | echo "You're now back on the '$BRANCH' branch." 32 | 33 | -------------------------------------------------------------------------------- /scripts/make-codex-subdirectory.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Need one and only one parameter 4 | if [ $# -ne 1 ]; then 5 | echo "Usage: $0 " 6 | echo "No spaces or such funny characters are allowed." 7 | exit 1 8 | fi 9 | 10 | # Make sure we're inside a git directory 11 | git status >/dev/null 2>&1 12 | if [ $? -ne 0 ]; then 13 | echo "error: run this script from inside a git repository" 14 | exit 1 15 | fi 16 | 17 | BRANCH=`git rev-parse --abbrev-ref HEAD` 18 | 19 | isEdition=`expr "$BRANCH" : 'editions'` 20 | 21 | if [ $isEdition -ne 8 ]; then 22 | echo "WARNING - you're starting a new branch from $BRANCH" 23 | echo "That doesn't look like an editions/x.x branch!" 24 | read -p "Hit Ctrl-C to cancel, or RETURN to continue" choice 25 | fi 26 | 27 | # Checkout the new branch, create the directory & enter it 28 | git checkout -b $1 29 | mkdir $1 30 | pushd $1 31 | # Create the standard directory structure, and enter it 32 | mkdir -p assets projects/starter projects/final projects/challenge 33 | touch assets/.keep projects/starter/.keep projects/final/.keep projects/challenge/.keep 34 | # Jump back out, and commit the changes 35 | popd 36 | git add $1 37 | git commit -m "Adding $1" $1 38 | git checkout $BRANCH 39 | 40 | echo Added directory, branch, and initial commit for "$1". 41 | echo "You're now back on the '$BRANCH' branch." 42 | 43 | --------------------------------------------------------------------------------