Create a new directory and perform the following tasks:
Use the init
command to initialize a new local repository inside the directory you just created.
Check if a (hidden) directory .git
has been created. What does this directory contain? What is it used for?
Create a new README
file.
Use the status
command to check the status of the newly created file. What does it say?
Use the add
command to add the file to the staging area.
Execute the command status
again. What’s the difference now?
Use the commit
command to commit the contents of the staging area.
Create a directory myproject
and add some files to this directory.
Use the add
command to add all of these new files to the staging area, but without using the names of the individual files. Check if you succeeded with the status
command and eventually commit the staged files.
Change the contents of one of the files and use the (git) diff
command to view the changes.
Use the add
command on the changed file and execute (git) diff
again. What do you see? What do you need to add to your command to see the changes again? Commit all changes.
Use the log
command to get an overview of all commits created so far.
Use the show
command to look at the details of an individual commit.
Use the git rm
command to remove a file and check the status
. Commit the change.
Now use the non-git rm
command to remove another file and check the status
. What difference do you notice compared to the previous step? Commit the change.
Use the (git) diff
command to look at all changes that were introduced in one of the first three commits, i.e. all changes of these three commits combined.