Perform the following commands:
- Initialize a new git repository locally (you don't need to push it)
- Add a simple README.md text file (
touch README.md
) and commit it - Check the commit with
git log
- Check the size of the repository directory
- On the parent,
du -sh .
- On the parent,
- Add a fairly big file
file.txt
(around 100MB)dd if=/dev/random of=file.txt count=1024 bs=10257
- Add and commit it locally
git add file.txt; git commit -m "Add big file"
- Check the size of the repository directory again (take note of this)
- On the parent,
du -sh .
- On the parent,
- Revert the commit that added the big file
- use
git revert
,git reset
orgit rebase
- use
- Check the size of the repository directory again (take note of this)
- On the parent,
du -h
- On the parent,
Questions
Create a file c01-git03-1.txt answering the questions below. Include details and commands used.
- Did you notice any difference in the size of the repo before and after adding the big file?
- What is the reason for this problem?
- How do you remove something from Git history? Which commands would you use? What are the consequences?