Open githubteacher opened 6 years ago
@brianamarie I think if we are going to try to have all of our training content in the manual format (which I believe we do) , we should include the advanced content in a book format.
I know this has been sitting here for a while - I would like to add these sections in the future, but am currently unsure of when I'll have the bandwidth to do this. I'll leave this issue open. If anyone else would like to start this off, please feel free. š
Adding on to this issue - it would be āØ if we could have an additional script to run, which would open up several issues with more "advanced" topics. We could run this script in the case that we finish class early, or there are specific questions on these topics. The issues would have the instructions and some brief explanations for each concept.
An advantage of having these as issues rather than parts of the training manual is that it would easily allow us to sort during class based on interest. (ex: have people assign themselves to issues they're interested in.)
@brianamarie should this be in the programs backlog or should we hand this over to the implementation engineering team?
I think this makes sense to hand over to the implementation engineering team. š cc @beardofedu @rwnfoo @allthedoll @aharshbe @ppremk @DGpeach - these are potential improvements to the training manual that I started when I was actively training. Let me know if you have any questions! Feel free to let this hang out here until a customer requests it, or incorporate it as preparation for an upcoming engagement. It would be really handy to have in the appendix for more advanced customers.
Dropping in some notes here about other potential additional content:
training-manual
, and help them get accessThis should also include subtree information, at the very least, comparing and contrasting the why and usability for subtrees and submodules.
Does it make sense to put some advanced content outlines in the manual or in this repository?
cc @githubtraining/trainers
GitHub for Developers - Day 2 for Advanced Audiences
This outline is a more advanced version of GitHub for Developers day 2 and should only be used if you have finished all of the day 1 material, both merge conflicts in the
github-games
activity (including using a second remote to pull in the merge conflict on the second activity),git bisect
andgit revert
on the first day of training.Morning Warm-Up
Step 1
github-games
repository.git clone URL repo-name
to give the repository a different namepartner-instructions
in your partner's repo.Step 2
After your partner has completed step 1:
Creating Atomic commits
git checkout -b slow-down
git status
mkdir images
git mv texture.jpg images/texture.jpg
git status
git add -p
and stage the change for the image locationgit diff
git diff --staged
git diff HEAD
git diff --color-words
git commit
git status
git commit -am
How Commits are Made
Creating a Repository Locally
Creating a Repository on the Command Line
git init practice-repo
ls -al
tree .git
directorycat .git/HEAD
cat .git/refs/heads/master
touch README.md
tree .git
again, still no objectsgit add README.md
tree .git
again, you now have 1 object, this is the blobgit commit -m "Initializing the repo with a README"
tree .git
, now you have a tree object and a commit objectUse script to add files for reset activity (it is helpful to add this to the day 1 class repo):
for d in {1..6}; do touch file$d.md; git add file$d.md; git commit -m "adding file $d"; done
for ($d=1; $d -le 6;$d++) { touch file$d.md; git add file$d.md; git commit -m "adding file$d.md";}
Resetting History
What happens when you reset - which trees are overwritten by each of the reset modes?
Git reset modes - where the changes land
Demo soft reset
Demo mixed reset
Demo hard reset
Git reflog
git reflog
git cherry-pick
of single commitgit reset --hard
back to where file 6 was originally createdRebase
git checkout -b rebase-me
git rebase -i master
rebase-me
intomaster
Rebase with conflicts
rebase-conflict
echo "This is some awesome content for file 4" >> file4.md
git checkout master
echo "File 4 already has some awesome content, but I like conflict" >> file4.md
git checkout rebase-conflict
git rebase master
git status
git rebase --continue
Resets with Merge commits
git reset --hard HEAD~^
git reset --hard HEAD~^2
- tells git to reset along the 2nd parentAmending Commits
commit --amend
More fun with branches
git checkout master
git merge branch1 branch2
Filter branch
What is Filter branch? When is it used?
This is never something that is done lightly.
Use filter-branch to remove the .txt files you added earlier
git filter-branch --tree-filter 'rm -f *.txt' HEAD
Show the back-up branch created by git
refs/original/refs/heads/master
After you have verified
master
git update-ref -d refs/original/refs/heads/master
git reflog expire --expire=now --all && git gc --prune=now
Show BFG Repo Cleaner and discuss the difference
Tags and Releases
git tag -a v1.0 SHA
git lol
to show tag pointergit show v1.0
git checkout v1.0
cat .git/HEAD
git checkout -b new-branch
git checkout -b new-branch v1.0
git push --tags
Submodules
Add the submodule to the repository
git submodule add https://github.com/githubtraining/example-submodule.git
git status
cat .gitmodules
tree .git
to show that the .git of the submodule has been added to the .git of the primary repogit diff --cached
to show the content ofexample-submodule
which should just be the sha of the current master in that branchShow the submodule on GitHub
Working with repo with Submodules
git pull
git submodule init
git submodule update
git clone --recursive URL
to handle this during the clonegit submodule update --init
Workflows for making changes in Submodules
git push --recurse-submodules=on-demand
Submodule Scripts
services-web
Scripts to rule them all
git submodule sync --quiet --recursive
.gitmodules
file and makes sure the URL listed for the submodule still matches what is in your local.git
. If not, it updates it.--recursive
tells Git to also update any nested submodules.git submodule update --init --recursive
cd
ing into the submodule and typinggit pull
.--init
also initializes any submodules that have not previously been initialized locally. In other words, it takes the information from.gitmodules
and uses it to create a home for the submodule in.git/modules
--recursive
tells Git to also update any nested submodules.