Nathan Trenholm | Partner | Data Insight Partners | Cohort 6 |
Daphne Jenkins | Data Engineer | Fayette County Public Schools | Cohort 5 |
Jason Becker | Chief Product Officer | Allovue | Cohort 4 |
Billy Buchanan | Director of Data, Research, & Accountability | Fayette County Public Schools | Cohort 5 |
mkdir -p ~/.git_template/{hooks,info}
cp [repo]/.gitconfig ~/.git_template/info/exclude
cp [repo]/.gitattributes ~/.git_template/info/attributes
git config --global core.excludesfile '~/.git_template/info/exclude'
git config --global core.attributesfile '~/.git_template/info/attributes'
# Move to a location where you will clone the repository on your machine
cd ~/Desktop/Programs/other
# Clone the hello-world example
git clone https://github.com/wbuchanan/hello-world.git
# Move to the directory where the repository was cloned
cd hello-world
# Create a new branch to work on
git checkout -b submoduleExample
# Add a submodule
git submodule add https://github.com/wbuchanan/hello-submodule submodule
# Check the status
git status
# New file starting with git so we'll look at it
cat .gitmodules
# There's also a new directory called submodule that we want to look at
ls -lah submodule
# If we look at the log in the root directory we only see the root directory changes
git log
# Move into the submodule subdirectory
cd submodule
# Now, if we look at the log we only see the log for the submodule
git log
# Move back into the root directory
cd ../
# If you want to remove the submodules it is a bit more involved
git submodule deinit -f submodule
git rm -f submodule .gitmodules
# Now move back to the original master
git checkout master
# You can create a new branch based on a specific point in time
git checkout -b newBranchOldCode 2cbc7a4ecd5f041e3777707635afacd50e7ba225
# And now all of the history is gone from this branch
git log
# and can easily get back to the point in time that we need
git checkout master
# And verify it
git log
#### Warning do not use git reset without first using git stash
# Stash your changes
git stash
# Show the stashed changes
git stash list
# Git reset
git reset --soft 2cbc7a4ecd5f041e3777707635afacd50e7ba225
# When you really just need to blow things up and get rid of the painful memories
git reset --hard 6c8487392b19ce6db1d75b276a1356b9fdeb07c5
# Apply the stashed changes
git stash apply
# Can also apply a specific stashed change
git stash apply stash@{0}